i want to set a command handler aliases, but the bot is doesn’t response.
in ping.js ===
JavaScript
x
8
1
module.exports = {
2
name: 'ping',
3
aliases: ['pong'],
4
execute(message, client) {
5
message.reply('pong!')
6
}
7
}
8
How i can set?
Advertisement
Answer
You would want to make certain changes in your command handler as well! the suitable changes you need to make would be:
- Making it in your execute function so it can find and execute aliases too!
JavaScript
1
3
1
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
2
command.execute(message,client);
3
Your definitions of command
and commandName
may vary so I suggest refering to your own code and making suitable changes rather than copy pasting.