From 20129cc3ef80e8549d8b2052bba55db0982c0d3e Mon Sep 17 00:00:00 2001 From: James Shiffer Date: Tue, 6 Feb 2024 18:12:00 -0800 Subject: [PATCH] Move command to its own folder --- discord/commands/{ => chat}/chat.ts | 4 ++-- discord/deploy.ts | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) rename discord/commands/{ => chat}/chat.ts (96%) diff --git a/discord/commands/chat.ts b/discord/commands/chat/chat.ts similarity index 96% rename from discord/commands/chat.ts rename to discord/commands/chat/chat.ts index 639b03d..082ea52 100644 --- a/discord/commands/chat.ts +++ b/discord/commands/chat/chat.ts @@ -1,6 +1,6 @@ import { InteractionResponse, Message, MessageComponentInteraction, SlashCommandBuilder } from 'discord.js'; import { ChatMessage, llamacpp, streamText } from 'modelfusion'; -import { logInfo, logError } from '../../logging'; +import { logInfo, logError } from '../../../logging'; const llamaCppServer = llamacpp.Api({ baseUrl: { @@ -49,7 +49,7 @@ async function llamaChat(interaction: MessageComponentInteraction) } } -export default { +export = { data: new SlashCommandBuilder() .setName('chat') .setDescription('Miku adds to the conversation with an AI-generated response.'), diff --git a/discord/deploy.ts b/discord/deploy.ts index 67fc4b2..b52df31 100644 --- a/discord/deploy.ts +++ b/discord/deploy.ts @@ -16,11 +16,7 @@ for (const folder of commandFolders) { for (const file of commandFiles) { const filePath = path.join(commandsPath, file); const command = require(filePath); - if ('data' in command && 'execute' in command) { - commands.push(command.data.toJSON()); - } else { - console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); - } + commands.push(command.data.toJSON()); } }