Fix message empty crashing bot
This commit is contained in:
parent
e359603352
commit
2d8ca95ecb
1 changed files with 3 additions and 1 deletions
|
@ -4,11 +4,13 @@ module.exports = {
|
|||
name: 'ask',
|
||||
description: 'Randomly answer with Yes, or No, or if you ask a question with "or" in it, answer with either statement before or after "or"',
|
||||
execute({message, args}) {
|
||||
let answer = randomNumber(0, 1) === 1 ? "Yes" : "No";
|
||||
let answer = "";
|
||||
if(args.length > 2 && args.includes("or")){
|
||||
let question = args.join(" ").split("or ");
|
||||
answer = question[randomNumber(0, question.length -1)];
|
||||
}
|
||||
if(answer === "")
|
||||
answer = randomNumber(0, 1) === 1 ? "Yes" : "No";
|
||||
message.channel.send(answer)
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue