if(args[0] == '8ball') {
if(args[1] == 'help' || ' ') {
if(args[1] == ' ') {
message.channel.send(eightballHelpMessage);
message.channel.send(needArgumentMessage);
} else {
message.channel.send(eightballHelpMessage);
}
} else {
message.channel.send(eightball[Math.floor(Math.random()*20)]);
}
};
My discord.js bot has a command that has another if-else inside of it that will send a help message for the specific command if args1 is equal to either "help" or nothing. Then there is another if-else inside the second if-else (third if-else) who will either send the constant eightballHelpMessage AND the constant needArgumentMessage or just eightballHelpMessage. The problem is that when "args1 == ' '" evaluates, even when it is true, as in the case of "~8ball", it, for some reason, evaluates as false and runs the code below else, which sends just the constant eightballHelpMessage. I tried looking for similar questions on stackoverflow, but I couldn't find anything in my circumstance and in javascript.
Aucun commentaire:
Enregistrer un commentaire