guide
guide copied to clipboard
Hard transition from handling section to further command examples
In the "handling commands" section we attach the data to be deployed to the respective export, so it is packed with its execution.
The slash command section provides more examples of using command builders, but defines them as a const
for demonstration purposes.
It is expected that you still just use them as demonstrated in the other guide section. Just define it on the respective export, in the data
key, as before.
We could potentially remedy this by using it in the same context as previous sections, for example
module.exports = {
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back')
.setRequired(true));
async execute(/* ... */) {
// ...
},
};
Originally posted by @almostSouji in https://github.com/discordjs/guide/issues/1237#issuecomment-1229525205