mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 05:49:49 +02:00
Minor changes
This commit is contained in:
@@ -42,15 +42,14 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (msgs.first().content.toLowerCase() === 'end') 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 guess = await this.finish(msg.channel);
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0xF78B26)
|
.setColor(0xF78B26)
|
||||||
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
|
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
|
||||||
.setDescription(stripIndents`
|
.setDescription(stripIndents`
|
||||||
${guess.name}
|
${guess.name}${guess.description ? `\n_${guess.description}_` : ''}
|
||||||
_${guess.description}_
|
|
||||||
`)
|
`)
|
||||||
.setThumbnail(guess.absolute_picture_path);
|
.setThumbnail(guess.absolute_picture_path);
|
||||||
await msg.embed(embed);
|
await msg.embed(embed);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ module.exports = class BattleCommand extends Command {
|
|||||||
time: 30000
|
time: 30000
|
||||||
});
|
});
|
||||||
if (!turn.size) {
|
if (!turn.size) {
|
||||||
await msg.say('Time!');
|
await msg.say('Sorry, time is up!');
|
||||||
reset();
|
reset();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ module.exports = class HangmanCommand extends Command {
|
|||||||
const display = '_'.repeat(word.length).split('');
|
const display = '_'.repeat(word.length).split('');
|
||||||
while (word.length !== confirmation.length && points < 7) {
|
while (word.length !== confirmation.length && points < 7) {
|
||||||
await msg.say(stripIndents`
|
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
|
time: 30000
|
||||||
});
|
});
|
||||||
if (!guess.size) {
|
if (!guess.size) {
|
||||||
await msg.say('Time!');
|
await msg.say('Sorry, time is up!');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const choice = guess.first().content.toLowerCase();
|
const choice = guess.first().content.toLowerCase();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ module.exports = class MathGameCommand extends Command {
|
|||||||
max: 1,
|
max: 1,
|
||||||
time: 10000
|
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}.`);
|
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!');
|
return msg.say('Nice job! 10/10! You deserve some cake!');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ module.exports = class QuizCommand extends Command {
|
|||||||
max: 1,
|
max: 1,
|
||||||
time: 15000
|
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}.`);
|
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!');
|
return msg.say('Nice job! 10/10! You deserve some cake!');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -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!`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -55,7 +55,7 @@ module.exports = class TicTacToeCommand extends Command {
|
|||||||
time: 30000
|
time: 30000
|
||||||
});
|
});
|
||||||
if (!turn.size) {
|
if (!turn.size) {
|
||||||
await msg.say('Time!');
|
await msg.say('Sorry, time is up!');
|
||||||
userTurn = !userTurn;
|
userTurn = !userTurn;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ module.exports = class WhosThatPokemonCommand extends Command {
|
|||||||
max: 1,
|
max: 1,
|
||||||
time: 15000
|
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}.`);
|
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!');
|
return msg.say('Nice job! 10/10! You deserve some cake!');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "47.9.0",
|
"version": "47.9.1",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user