From c1cf113b0a9e6d00dd662cc4922bffc5eecf5702 Mon Sep 17 00:00:00 2001 From: perzeuss <11357019+perzeuss@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:50:15 +0100 Subject: [PATCH] feat: add command to reset chat history --- src/bot.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/bot.ts b/src/bot.ts index 98562f2..709a252 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -48,6 +48,10 @@ class DiscordBot { if (interaction.commandName === 'chat') { await this.handleChatCommand(interaction); + } else if (interaction.commandName === 'new-conversation') { + const cacheId = this.CACHE_MODE && this.CACHE_MODE === 'user' ? interaction.user.id : interaction.channelId; + conversationCache.delete(cacheId); + await interaction.reply('New conversation started!'); } }); } @@ -66,6 +70,14 @@ class DiscordBot { .setDescription('Your message') .setRequired(true)) .toJSON(), + new SlashCommandBuilder() + .setName('new-conversation') + .setDescription('Start a new conversation with the bot. This will clear the chat history.') + // .addStringOption(option => + // option.setName('summarize') + // .setDescription('Summarize the current conversation history and take it over to the new conversation.') + // .setRequired(true)) + .toJSON(), ]; const rest = new REST({ version: '9' }).setToken(this.TOKEN);