If args contain "or" return either side randomly
This commit is contained in:
parent
4adc97d6ae
commit
0181007ad5
1 changed files with 6 additions and 2 deletions
|
@ -2,9 +2,13 @@ const randomNumber = require("../../util/randomNumber");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ask',
|
name: 'ask',
|
||||||
description: 'Randomly answer with Yes, or No',
|
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}) {
|
execute({message, args}) {
|
||||||
let answer = randomNumber(0, 1) === 1 ? "Yes" : "No";
|
let answer = randomNumber(0, 1) === 1 ? "Yes" : "No";
|
||||||
|
if(args.length > 2 && args.includes("or")){
|
||||||
|
let question = args.join(" ").split("or ");
|
||||||
|
answer = randomNumber(0, 1) === 1 ? question[0] : question[1];
|
||||||
|
}
|
||||||
message.channel.send(answer)
|
message.channel.send(answer)
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue