-
Notifications
You must be signed in to change notification settings - Fork 77
Commands
Almost all of our commands and any new commands made should be slash commands. These slash commands can be found in the new-era-commands/slash
directory. We do have a small number of legacy non-slash commands in the botCommands
directory, but going forward, slash commands are desired.
The basic template for a slash commands is as follows. You can learn more about how to create slash commands in the discord.js guides. If you want a command to reply with an embed, you can create embeds using the EmbedBuilder.
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName() // pass in the name of the command
.setDescription(), // pass in the description that will show
// additional command options can be set here
execute: async (interaction) => {
// additional interaction logic goes here
await interaction.reply(); // pass in the details of the bot reply
},
};
Slash commands are automatically updated and deployed when the bot initialises, as index.js
automatically runs our deploy script from bin/deploy-commands.js
. Therefore, you do not need to manually deploy after creating or updating any slash commands. You just need to start or restart the bot.
More information about the discord.js API, such as the interaction parameter, can be found in the discord.js documentation.
Currently, we are using discord.js v14.