Skip to content

Commit

Permalink
fixed???
Browse files Browse the repository at this point in the history
  • Loading branch information
sulphite committed Apr 24, 2024
1 parent c377f65 commit 4dc1f74
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/commandCenter/commands/Partify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import {
Client,
ApplicationCommandOptionType,
ApplicationCommandType,
GuildScheduledEventCreateOptions,
GuildScheduledEventEntityType,
GuildScheduledEventPrivacyLevel,
} from 'discord.js'
import { Command } from '../../Command'
import { stringToTime } from '../utils/stringToTime'
Expand Down Expand Up @@ -41,12 +44,21 @@ export const Partify: Command = {
interaction.options.get('theme')?.value as string,
partySystemPrompt
)
const partyJson = JSON.parse(generatedPartyIdea)
const partyJson: {name: string; description: string;} = JSON.parse(generatedPartyIdea)
console.log(partyJson)
// this gives us an object to use in creating the event
// { name: string, description: string }
const newEvent: GuildScheduledEventCreateOptions = {
...partyJson,
scheduledStartTime: targetTime,
scheduledEndTime: dayjs(targetTime).add(1,"hour").toDate(),
entityType: GuildScheduledEventEntityType.External,
privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly,
entityMetadata: {location: "voice channel"}
}

// code to generate event goes here
interaction.guild?.scheduledEvents.create(newEvent)

await interaction.followUp({
content: `OK! You've got a party coming up at <t:${dayjs(targetTime).unix()}>`,
Expand Down

0 comments on commit 4dc1f74

Please sign in to comment.