mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 14:19:56 +02:00
Beep beep
This commit is contained in:
@@ -28,7 +28,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
answers.push('end');
|
||||
await msg.say(stripIndents`
|
||||
**${++data.step}.** ${data.question}
|
||||
${data.answers.map(answer => answer.answer).join(' | ')} | End
|
||||
${data.answers.map(answer => answer.answer).join(' | ')}
|
||||
`);
|
||||
const filter = res => res.author.id === msg.author.id && answers.includes(res.content.toLowerCase());
|
||||
const msgs = await msg.channel.awaitMessages(filter, {
|
||||
@@ -63,7 +63,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
return msg.say(response === 'yes' ? 'Another win for me!' : 'Bravo, you have defeated me.');
|
||||
} catch (err) {
|
||||
this.sessions.delete(msg.channel.id);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,7 @@ module.exports = class BattleCommand extends Command {
|
||||
});
|
||||
if (!turn.size) {
|
||||
await msg.say('Time!');
|
||||
forfeit();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
choice = turn.first().content.toLowerCase();
|
||||
} else {
|
||||
@@ -114,7 +113,7 @@ module.exports = class BattleCommand extends Command {
|
||||
`);
|
||||
} catch (err) {
|
||||
this.fighting.delete(msg.channel.id);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ module.exports = class EmojiEmojiRevolutionCommand extends Command {
|
||||
return msg.say(`You win ${aPts > oPts ? msg.author : opponent} with ${aPts > oPts ? aPts : oPts} points!`);
|
||||
} catch (err) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ module.exports = class GunfightCommand extends Command {
|
||||
return msg.say(`And the winner is ${winner.first().author.username}!`);
|
||||
} catch (err) {
|
||||
this.fighting.delete(msg.channel.id);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,6 +54,7 @@ module.exports = class HangmanCommand extends Command {
|
||||
break;
|
||||
}
|
||||
const choice = guess.first().content.toLowerCase();
|
||||
if (choice === 'end') break;
|
||||
if (confirmation.includes(choice) || incorrect.includes(choice)) {
|
||||
await msg.say('You have already picked that letter!');
|
||||
} else if (word.includes(choice)) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const math = require('mathjs');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { list } = require('../../structures/Util');
|
||||
const difficulties = ['easy', 'medium', 'hard', 'extreme', 'impossible'];
|
||||
@@ -20,7 +19,6 @@ module.exports = class MathGameCommand extends Command {
|
||||
group: 'games',
|
||||
memberName: 'math-game',
|
||||
description: 'See how fast you can answer a math problem in a given time limit.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'difficulty',
|
||||
@@ -40,11 +38,15 @@ module.exports = class MathGameCommand extends Command {
|
||||
const value1 = Math.floor(Math.random() * maxValues[difficulty]) + 1;
|
||||
const value2 = Math.floor(Math.random() * maxValues[difficulty]) + 1;
|
||||
const operation = operations[Math.floor(Math.random() * operations.length)];
|
||||
const expression = `${value1} ${operation} ${value2}`;
|
||||
const answer = math.eval(expression).toString();
|
||||
let answer;
|
||||
switch (operation) {
|
||||
case '+': answer = value1 + value2; break;
|
||||
case '-': answer = value1 - value2; break;
|
||||
case '*': answer = value1 * value2; break;
|
||||
}
|
||||
await msg.say(stripIndents`
|
||||
**You have 10 seconds to answer this question.**
|
||||
${expression}
|
||||
${value1} ${operation} ${value2}
|
||||
`);
|
||||
const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
|
||||
max: 1,
|
||||
|
||||
@@ -13,7 +13,6 @@ module.exports = class QuizCommand extends Command {
|
||||
group: 'games',
|
||||
memberName: 'quiz',
|
||||
description: 'Answer a quiz question.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
|
||||
@@ -37,7 +37,7 @@ module.exports = class QuizletGameCommand extends Command {
|
||||
while (terms.length > 0) {
|
||||
const term = terms[0];
|
||||
await msg.say(stripIndents`
|
||||
**You have 30 seconds to answer which word this is.** _Type "end game" to end the game._
|
||||
**You have 30 seconds to answer which word this is.**
|
||||
${term.definition}
|
||||
${term.image ? term.image.url : ''}
|
||||
`);
|
||||
@@ -47,10 +47,10 @@ module.exports = class QuizletGameCommand extends Command {
|
||||
});
|
||||
if (!msgs.size) {
|
||||
await msg.say('Time!');
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
const choice = msgs.first().content.toLowerCase();
|
||||
if (choice === 'end game') break;
|
||||
if (choice === 'end') break;
|
||||
if (choice !== term.term.toLowerCase()) {
|
||||
await msg.say(`Nope, sorry, it was ${term.term}.`);
|
||||
if (seen.has(term.term)) seen.delete(term.term);
|
||||
|
||||
@@ -56,9 +56,10 @@ module.exports = class TicTacToeCommand extends Command {
|
||||
});
|
||||
if (!turn.size) {
|
||||
await msg.say('Time!');
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
const choice = turn.first().content;
|
||||
const choice = turn.first().content.toLowerCase();
|
||||
if (choice === 'end') break;
|
||||
if (taken.includes(choice)) {
|
||||
await msg.say('That spot is already taken!');
|
||||
} else if (!sides.includes(choice)) {
|
||||
@@ -83,7 +84,7 @@ module.exports = class TicTacToeCommand extends Command {
|
||||
return msg.say(winner ? `Congrats, ${winner}!` : 'Oh... The cat won.');
|
||||
} catch (err) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ module.exports = class TypingGameCommand extends Command {
|
||||
group: 'games',
|
||||
memberName: 'typing-game',
|
||||
description: 'See how fast you can type a sentence in a given time limit.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'difficulty',
|
||||
|
||||
@@ -10,8 +10,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
||||
aliases: ['who-pokemon', 'whos-that-pokémon', 'who-pokémon'],
|
||||
group: 'games',
|
||||
memberName: 'whos-that-pokemon',
|
||||
description: 'Guess who that Pokémon is.',
|
||||
clientPermissions: ['EMBED_LINKS']
|
||||
description: 'Guess who that Pokémon is.'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user