This commit is contained in:
Daniel Odendahl Jr
2017-05-24 13:15:59 +00:00
parent 9960929b54
commit 7baf540581
3 changed files with 12 additions and 10 deletions
+10 -8
View File
@@ -20,16 +20,18 @@ module.exports = class QuizCommand extends Command {
return msg.say('This Command requires the `Embed Links` Permission.');
try {
const { body } = await snekfetch
.get('http://jservice.io/api/random')
.get('https://opentdb.com/api.php')
.query({
count: 1
amount: 1,
type: 'boolean'
});
const answer = body[0].answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
const answer = body.results[0].correct_answer.toLowerCase();
const embed = new RichEmbed()
.setTitle('You have **15** seconds to answer this question:')
.setDescription(stripIndents`
**Category: ${body[0].category.title}**
${body[0].question}
**Category: ${body.results[0].category}**
**Difficulty: ${body.results[0].difficulty}**
${body.results[0].question}
`);
msg.embed(embed);
try {
@@ -39,10 +41,10 @@ module.exports = class QuizCommand extends Command {
errors: ['time']
});
if (collected.first().content.toLowerCase() !== answer)
return msg.say(`The correct answer is: ${answer}.`);
return msg.say(`Perfect! The correct answer is: ${answer}.`);
return msg.say(`Nope, sorry, it\'s ${answer}.`);
return msg.say('Nice job! 10/10! You deserve some cake!');
} catch (err) {
return msg.say(`Time! The correct answer is: ${answer}`);
return msg.say(`Time! It was ${answer}, sorry!`);
}
} catch (err) {
return msg.say(`${err.name}: ${err.message}`);
+1 -1
View File
@@ -15,7 +15,7 @@ module.exports = class InviteCommand extends Command {
const invite = await this.client.generateInvite('1345846343');
return msg.say(stripIndents`
Add me to your server with this link:
${invite}
<${invite}>
Or, come to my server with this link:
${this.client.options.invite}
`);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "20.1.1",
"version": "20.1.2",
"description": "A Discord Bot",
"main": "Shard.js",
"scripts": {