mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Better Validators and More Destucturing
This commit is contained in:
@@ -16,8 +16,7 @@ module.exports = class LotteryCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const lottery = Math.floor(Math.random() * 100) + 1;
|
||||
const userName = message.author.username;
|
||||
if (lottery < 100) return message.say(`Nope, sorry ${userName}, you lost.`);
|
||||
return message.say(`Wow ${userName}! You actually won! Great job!`);
|
||||
if (lottery < 99) return message.say(`Nope, sorry ${message.author.username}, you lost.`);
|
||||
return message.say(`Wow ${message.author.username}! You actually won! Great job!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,9 +22,9 @@ module.exports = class QuizCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
try {
|
||||
const response = await request
|
||||
const { body } = await request
|
||||
.get('http://jservice.io/api/random?count=1');
|
||||
const data = response.body[0];
|
||||
const data = body[0];
|
||||
const answer = data.answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('You have **fifteen** seconds to answer this question:')
|
||||
|
||||
@@ -19,10 +19,9 @@ module.exports = class SlotsCommand extends Command {
|
||||
const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotFour = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
if (slotOne === slotTwo && slotOne === slotThree && slotOne === slotFour) {
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nWow! You won! Great job... er... luck!`);
|
||||
if (slotOne === slotTwo && slotOne === slotThree) {
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nWow! You won! Great job... er... luck!`);
|
||||
}
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}|${slotFour}\nAww... You lost... Guess it's just bad luck, huh?`);
|
||||
return message.say(`${slotOne}|${slotTwo}|${slotThree}\nAww... You lost... Guess it's just bad luck, huh?`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user