Pass objects on command.execute
Pass objects instead of using a switch statement. Now I don't have to restart the bot whenever I add a new command that needs specific arguments other than 'message'.
This commit is contained in:
parent
564500869e
commit
c51a4fa976
11 changed files with 11 additions and 29 deletions
20
server.js
20
server.js
|
@ -34,25 +34,7 @@ client.on('message', async message => {
|
|||
if (!message.content.startsWith(prefix)) return;
|
||||
|
||||
try {
|
||||
|
||||
switch (commandName) {
|
||||
case "ban":
|
||||
case "botinfo":
|
||||
case "reload":
|
||||
case "uptime":
|
||||
command.execute(message, client, args);
|
||||
break;
|
||||
case "say":
|
||||
case "e":
|
||||
case "help":
|
||||
case "userinfo":
|
||||
case "katti":
|
||||
case "pfp":
|
||||
command.execute(message, args);
|
||||
break;
|
||||
default:
|
||||
command.execute(message)
|
||||
}
|
||||
command.execute({message:message, args:args, client: client})
|
||||
} catch (error) {
|
||||
console.log(`${error}\n-------`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue