Create A New AI Slash Command
Now we want to be able to call the Open AI using our Discord bot. Here we will implement a new slash command: /ask
.
info
Slash commands let you trigger bot responses using a /command
in Discord.
task
- Create a new file called
ai.js
in thecommands/utilities
folder. - Create a new slash command for the AI wrapper
tip
import { SlashCommandBuilder } from 'discord.js'
export const data = new SlashCommandBuilder()
.setName('some command');
// can add more information about the slash command
async function execute (interaction) {
// do something
}
export { data, execute };