From 4dc1f7486ad99d382df62e6e19196afb2158c9fb Mon Sep 17 00:00:00 2001 From: Janett Gerrard Date: Wed, 24 Apr 2024 18:53:37 +0100 Subject: [PATCH] fixed??? --- src/commandCenter/commands/Partify.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/commandCenter/commands/Partify.ts b/src/commandCenter/commands/Partify.ts index e9f3bb1..7dd101f 100755 --- a/src/commandCenter/commands/Partify.ts +++ b/src/commandCenter/commands/Partify.ts @@ -3,6 +3,9 @@ import { Client, ApplicationCommandOptionType, ApplicationCommandType, + GuildScheduledEventCreateOptions, + GuildScheduledEventEntityType, + GuildScheduledEventPrivacyLevel, } from 'discord.js' import { Command } from '../../Command' import { stringToTime } from '../utils/stringToTime' @@ -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 `,