mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
stripIndents
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const math = require('mathjs');
|
||||
const operations = ['+', '-', '*'];
|
||||
|
||||
@@ -63,16 +64,16 @@ module.exports = class MathGameCommand extends Command {
|
||||
errors: ['time']
|
||||
});
|
||||
if (collected.first().content !== solved)
|
||||
return msg.say(
|
||||
`Aw... Too bad, try again next time!
|
||||
The correct answer is: ${solved}`
|
||||
);
|
||||
return msg.say(stripIndents`
|
||||
Aw... Too bad, try again next time!
|
||||
The correct answer is: ${solved}
|
||||
`);
|
||||
return msg.say(`Good Job! You won! ${solved} is the correct answer!`);
|
||||
} catch (err) {
|
||||
return msg.say(
|
||||
`Aw... Too bad, try again next time!
|
||||
The correct answer is: ${solved}`
|
||||
);
|
||||
return msg.say(stripIndents`
|
||||
Aw... Too bad, try again next time!
|
||||
The correct answer is: ${solved}
|
||||
`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const request = require('superagent');
|
||||
|
||||
module.exports = class QuizCommand extends Command {
|
||||
@@ -25,10 +26,10 @@ module.exports = class QuizCommand extends Command {
|
||||
const answer = body[0].answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
|
||||
const embed = new RichEmbed()
|
||||
.setTitle('You have **15** seconds to answer this question:')
|
||||
.setDescription(
|
||||
`**Category: ${body[0].category.title}**
|
||||
${body[0].question}`
|
||||
);
|
||||
.setDescription(stripIndents`
|
||||
**Category: ${body[0].category.title}**
|
||||
${body[0].question}
|
||||
`);
|
||||
await msg.embed(embed);
|
||||
try {
|
||||
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
@@ -40,10 +41,10 @@ module.exports = class QuizCommand extends Command {
|
||||
return msg.say(`The correct answer is: ${answer}`);
|
||||
return msg.say(`Perfect! The correct answer is: ${answer}`);
|
||||
} catch (err) {
|
||||
return msg.say(
|
||||
`Aw... Too bad, try again next time!
|
||||
The Correct Answer was: ${answer}`
|
||||
);
|
||||
return msg.say(stripIndents`
|
||||
Aw... Too bad, try again next time!
|
||||
The Correct Answer was: ${answer}
|
||||
`);
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const slotThing = [':grapes:', ':tangerine:', ':pear:', ':cherries:'];
|
||||
|
||||
module.exports = class SlotsCommand extends Command {
|
||||
@@ -16,13 +17,13 @@ module.exports = class SlotsCommand extends Command {
|
||||
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
if (slotOne === slotTwo && slotOne === slotThree)
|
||||
return msg.say(
|
||||
`${slotOne}|${slotTwo}|${slotThree}
|
||||
Wow! You won! Great job... er... luck!`
|
||||
);
|
||||
return msg.say(
|
||||
`${slotOne}|${slotTwo}|${slotThree}
|
||||
Aww... You lost... Guess it's just bad luck, huh?`
|
||||
);
|
||||
return msg.say(stripIndents`
|
||||
${slotOne}|${slotTwo}|${slotThree}
|
||||
Wow! You won! Great job... er... luck!
|
||||
`);
|
||||
return msg.say(stripIndents`
|
||||
${slotOne}|${slotTwo}|${slotThree}
|
||||
Aww... You lost... Guess it's just bad luck, huh?
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user