Move command to its own folder
This commit is contained in:
		
							parent
							
								
									c37d2eace8
								
							
						
					
					
						commit
						20129cc3ef
					
				| @ -1,6 +1,6 @@ | |||||||
| import { InteractionResponse, Message, MessageComponentInteraction, SlashCommandBuilder } from 'discord.js'; | import { InteractionResponse, Message, MessageComponentInteraction, SlashCommandBuilder } from 'discord.js'; | ||||||
| import { ChatMessage, llamacpp, streamText } from 'modelfusion'; | import { ChatMessage, llamacpp, streamText } from 'modelfusion'; | ||||||
| import { logInfo, logError } from '../../logging'; | import { logInfo, logError } from '../../../logging'; | ||||||
| 
 | 
 | ||||||
| const llamaCppServer = llamacpp.Api({ | const llamaCppServer = llamacpp.Api({ | ||||||
|     baseUrl: { |     baseUrl: { | ||||||
| @ -49,7 +49,7 @@ async function llamaChat(interaction: MessageComponentInteraction) | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default { | export = { | ||||||
|     data: new SlashCommandBuilder() |     data: new SlashCommandBuilder() | ||||||
|         .setName('chat') |         .setName('chat') | ||||||
|         .setDescription('Miku adds to the conversation with an AI-generated response.'), |         .setDescription('Miku adds to the conversation with an AI-generated response.'), | ||||||
| @ -16,11 +16,7 @@ for (const folder of commandFolders) { | |||||||
|     for (const file of commandFiles) { |     for (const file of commandFiles) { | ||||||
|         const filePath = path.join(commandsPath, file); |         const filePath = path.join(commandsPath, file); | ||||||
|         const command = require(filePath); |         const command = require(filePath); | ||||||
|         if ('data' in command && 'execute' in command) { |  | ||||||
|         commands.push(command.data.toJSON()); |         commands.push(command.data.toJSON()); | ||||||
|         } else { |  | ||||||
|             console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user