From 7baf5405816017b96c1366450a4165867726c5af Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 24 May 2017 13:15:59 +0000 Subject: [PATCH] Quiz Fix --- commands/games/quiz.js | 18 ++++++++++-------- commands/util/invite.js | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/commands/games/quiz.js b/commands/games/quiz.js index 63fa9023..79ae4989 100644 --- a/commands/games/quiz.js +++ b/commands/games/quiz.js @@ -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>)/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}`); diff --git a/commands/util/invite.js b/commands/util/invite.js index d2a0be31..4591fe23 100644 --- a/commands/util/invite.js +++ b/commands/util/invite.js @@ -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} `); diff --git a/package.json b/package.json index 0e48e90f..1b635bf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "20.1.1", + "version": "20.1.2", "description": "A Discord Bot", "main": "Shard.js", "scripts": {