mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
msg
This commit is contained in:
+10
-10
@@ -15,10 +15,10 @@ module.exports = class QuizCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://jservice.io/api/random?count=1');
|
||||
@@ -26,21 +26,21 @@ module.exports = class QuizCommand extends Command {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('You have **15** seconds to answer this question:')
|
||||
.setDescription(`**Category: ${body[0].category.title}**\n${body[0].question}`);
|
||||
await message.embed(embed);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content.toLowerCase() !== answer)
|
||||
return message.say(`The correct answer is: ${answer}`);
|
||||
return message.say(`Perfect! The correct answer is: ${answer}`);
|
||||
return msg.say(`The correct answer is: ${answer}`);
|
||||
return msg.say(`Perfect! The correct answer is: ${answer}`);
|
||||
} catch (err) {
|
||||
return message.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
|
||||
return msg.say(`Aw... Too bad, try again next time!\nThe Correct Answer was: ${answer}`);
|
||||
}
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user