Minor changes

This commit is contained in:
Daniel Odendahl Jr
2017-10-19 18:50:39 +00:00
parent c056ca47e3
commit 571f81ff0c
9 changed files with 10 additions and 88 deletions
+2 -3
View File
@@ -42,15 +42,14 @@ module.exports = class AkinatorCommand extends Command {
break;
}
if (msgs.first().content.toLowerCase() === 'end') break;
ans = answers.indexOf(msgs.first().content.toLowerCase());
ans = answers.indexOf(msgs.first().content.toLowerCase().replace(/(|)/g, '\''));
}
const guess = await this.finish(msg.channel);
const embed = new MessageEmbed()
.setColor(0xF78B26)
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
.setDescription(stripIndents`
${guess.name}
_${guess.description}_
${guess.name}${guess.description ? `\n_${guess.description}_` : ''}
`)
.setThumbnail(guess.absolute_picture_path);
await msg.embed(embed);
+1 -1
View File
@@ -67,7 +67,7 @@ module.exports = class BattleCommand extends Command {
time: 30000
});
if (!turn.size) {
await msg.say('Time!');
await msg.say('Sorry, time is up!');
reset();
continue;
}
+2 -2
View File
@@ -29,7 +29,7 @@ module.exports = class HangmanCommand extends Command {
const display = '_'.repeat(word.length).split('');
while (word.length !== confirmation.length && points < 7) {
await msg.say(stripIndents`
The word is: \`${display.join(' ')}\`. Which letter do you choose?
\`${display.join(' ')}\`. Which letter do you choose?
\`\`\`
___________
| |
@@ -44,7 +44,7 @@ module.exports = class HangmanCommand extends Command {
time: 30000
});
if (!guess.size) {
await msg.say('Time!');
await msg.say('Sorry, time is up!');
break;
}
const choice = guess.first().content.toLowerCase();
+1 -1
View File
@@ -52,7 +52,7 @@ module.exports = class MathGameCommand extends Command {
max: 1,
time: 10000
});
if (!msgs.size) return msg.say(`Time! It was ${answer}, sorry!`);
if (!msgs.size) return msg.say(`Sorry, time is up! It was ${answer}.`);
if (msgs.first().content !== answer.toString()) return msg.say(`Nope, sorry, it's ${answer}.`);
return msg.say('Nice job! 10/10! You deserve some cake!');
}
+1 -1
View File
@@ -63,7 +63,7 @@ module.exports = class QuizCommand extends Command {
max: 1,
time: 15000
});
if (!msgs.size) return msg.say(`Time! It was ${correct}, sorry!`);
if (!msgs.size) return msg.say(`Sorry, time is up! It was ${correct}.`);
if (msgs.first().content.toLowerCase() !== correct) return msg.say(`Nope, sorry, it's ${correct}.`);
return msg.say('Nice job! 10/10! You deserve some cake!');
} catch (err) {
-77
View File
@@ -1,77 +0,0 @@
const { Command } = require('discord.js-commando');
const { stripIndents } = require('common-tags');
const snekfetch = require('snekfetch');
const { shuffle } = require('../../util/Util');
const { QUIZLET_KEY } = process.env;
module.exports = class QuizletGameCommand extends Command {
constructor(client) {
super(client, {
name: 'quizlet',
aliases: ['quizlet-game', 'quizlet-quiz', 'quizlet-test'],
group: 'games',
memberName: 'quizlet',
description: 'Shuffle a Quizlet study set and play a game similar to a quiz.',
args: [
{
key: 'id',
prompt: 'What is the ID of the deck you wish to use?',
type: 'string',
parse: id => encodeURIComponent(id)
}
]
});
this.playing = new Set();
}
async run(msg, { id }) {
if (this.playing.has(msg.channel.id)) return msg.say('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
const { body } = await snekfetch
.get(`https://api.quizlet.com/2.0/sets/${id}/terms`)
.query({ client_id: QUIZLET_KEY });
const terms = shuffle(body);
const seen = new Set();
while (terms.length > 0) {
const term = terms[0];
await msg.say(stripIndents`
**You have 30 seconds to answer which word this is.**
${term.definition}
${term.image ? term.image.url : ''}
`);
const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
time: 30000
});
if (!msgs.size) {
await msg.say('Time!');
continue;
}
const choice = msgs.first().content.toLowerCase();
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);
terms.push(term);
} else {
await msg.say('Nice job! 10/10! You deserve some cake!');
if (seen.has(term.term)) {
seen.delete(term.term);
} else {
seen.add(term.term);
terms.push(term);
}
}
terms.shift();
}
this.playing.delete(msg.channel.id);
return msg.say('See you next time!');
} catch (err) {
this.playing.delete(msg.channel.id);
if (err.status === 404) return msg.say('Could not find any results.');
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -55,7 +55,7 @@ module.exports = class TicTacToeCommand extends Command {
time: 30000
});
if (!turn.size) {
await msg.say('Time!');
await msg.say('Sorry, time is up!');
userTurn = !userTurn;
continue;
}
+1 -1
View File
@@ -58,7 +58,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
max: 1,
time: 15000
});
if (!msgs.size) return msg.say(`Time! It was ${displayName}, sorry!`);
if (!msgs.size) return msg.say(`Sorry, time is up! It was ${displayName}.`);
if (!names.includes(msgs.first().content.toLowerCase())) return msg.say(`Nope, sorry, it's ${displayName}.`);
return msg.say('Nice job! 10/10! You deserve some cake!');
} catch (err) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "47.9.0",
"version": "47.9.1",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {