Skip to content

Instantly share code, notes, and snippets.

@Jackzmc
Created July 8, 2017 18:01
Show Gist options
  • Save Jackzmc/245ce0df59353f450f786bcaaea5ca16 to your computer and use it in GitHub Desktop.
Save Jackzmc/245ce0df59353f450f786bcaaea5ca16 to your computer and use it in GitHub Desktop.
if (msg.content.charAt(0) == prefix && msg.content.charAt(1) !== "_") {
for(var i=0;i<commands.main.length;i++) {
if(commands.main[i].cmd === arg[0]){
return commands.main[i].execute(msg,arg);
}
}
for(var i=0;i<custom_commands;i++) {
if(custom_commands[i].cmd === arg[0]){
return custom_commands[i].execute(msg,arg);
}
}
for(var i=0;i<commands.secondary.length;i++) {
if(commands.secondary[i].cmd === arg[0]){
return commands.secondary[i].execute(msg,arg);
}
}
msg.reply("Command was not found"); //should only run if forloop fails
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment