This commit is contained in:
Daniel Odendahl Jr
2017-11-09 00:02:59 +00:00
parent 819db49057
commit b6afded306
125 changed files with 743 additions and 289 deletions
+4 -6
View File
@@ -11,7 +11,7 @@ module.exports = class AkinatorCommand extends Command {
aliases: ['the-web-genie', 'web-genie'],
group: 'games',
memberName: 'akinator',
description: 'Play a game of Akinator.',
description: 'Think about a real or fictional character, I will try to guess who it is.',
clientPermissions: ['EMBED_LINKS']
});
@@ -22,7 +22,7 @@ module.exports = class AkinatorCommand extends Command {
if (this.sessions.has(msg.channel.id)) return msg.reply('Only one game may be occuring per channel.');
try {
let ans = null;
this.sessions.set(msg.channel.id, { progress: null });
this.sessions.set(msg.channel.id, { progress: 0 });
while (this.sessions.get(msg.channel.id).progress < 99) {
const data = ans === null ? await this.createSession(msg.channel) : await this.progress(msg.channel, ans);
if (!data || this.sessions.get(msg.channel.id).step >= 80) break;
@@ -30,7 +30,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(' | ')}
${data.answers.map(answer => answer.answer).join(' | ')} | End
`);
const filter = res => res.author.id === msg.author.id && answers.includes(res.content.toLowerCase());
const msgs = await msg.channel.awaitMessages(filter, {
@@ -48,9 +48,7 @@ module.exports = class AkinatorCommand extends Command {
const embed = new MessageEmbed()
.setColor(0xF78B26)
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
.setDescription(stripIndents`
${guess.name}${guess.description ? `\n_${guess.description}_` : ''}
`)
.setDescription(`${guess.name}${guess.description ? `\n_${guess.description}_` : ''}`)
.setThumbnail(guess.absolute_picture_path);
await msg.embed(embed);
const verification = await verify(msg.channel, msg.author);
+21 -4
View File
@@ -10,7 +10,7 @@ module.exports = class ApplesToApplesCommand extends Command {
name: 'apples-to-apples',
group: 'games',
memberName: 'apples-to-apples',
description: 'Play a game of Apples to Apples.',
description: 'Compete to see who can come up with the best card to match an adjective.',
guildOnly: true,
args: [
{
@@ -31,8 +31,8 @@ module.exports = class ApplesToApplesCommand extends Command {
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
await msg.say('You will need at least 2 more players, at maximum 20. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 20, 3);
await msg.say('You will need at least 2 more players, at maximum 10. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 10, 3);
if (!awaitedPlayers) {
this.playing.delete(msg.channel.id);
return msg.say('Game could not be started...');
@@ -86,7 +86,24 @@ module.exports = class ApplesToApplesCommand extends Command {
await player.user.send('Skipping your turn...');
continue;
}
player.hand.delete(chosen);
if (chosen === '<Blank>') {
await player.user.send(stripIndents`
What do you want the blank card to say?
Only answers under 100 characters will be counted.
`);
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length < 100, {
max: 1,
time: 120000
});
if (!blank.size) { // eslint-disable-line max-depth
await player.user.send('Skipping your turn...');
continue;
}
player.hand.delete('<Blank>');
chosen = blank.first().content;
} else {
player.hand.delete(chosen);
}
chosenCards.push({
id: player.id,
card: chosen
+19 -3
View File
@@ -11,7 +11,7 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
aliases: ['crude-cards', 'pretend-youre-xyzzy', 'cah'],
group: 'games',
memberName: 'cards-against-humanity',
description: 'Play a game of Cards Against Humanity.',
description: 'Compete to see who can come up with the best card to fill in the blank.',
guildOnly: true,
args: [
{
@@ -32,8 +32,8 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
await msg.say('You will need at least 2 more players, at maximum 20. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 20, 3);
await msg.say('You will need at least 2 more players, at maximum 10. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 10, 3);
if (!awaitedPlayers) {
this.playing.delete(msg.channel.id);
return msg.say('Game could not be started...');
@@ -88,6 +88,22 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
await player.user.send('Skipping your turn...');
continue;
}
if (chosen.includes('<Blank>')) {
await player.user.send(stripIndents`
What do you want the blank card to say?
Only answers under 100 characters will be counted.
`);
const blank = await player.user.dmChannel.awaitMessages(res => res.content.length < 100, {
max: 1,
time: 120000
});
if (!blank.size) { // eslint-disable-line max-depth
await player.user.send('Skipping your turn...');
continue;
}
player.hand.delete('<Blank>');
chosen[chosen.indexOf('<Blank>')] = blank.first().content;
}
for (const card of chosen) player.hand.delete(card);
chosenCards.push({
id: player.id,
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = class EmojiEmojiRevolutionCommand extends Command {
aliases: ['eer'],
group: 'games',
memberName: 'emoji-emoji-revolution',
description: 'Play a game of Emoji Emoji Revolution.',
description: 'Can you type arrow emoji faster than anyone else has ever typed them before?',
guildOnly: true,
args: [
{
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = class GunfightCommand extends Command {
aliases: ['western-gunfight'],
group: 'games',
memberName: 'gunfight',
description: 'Engage in a western gunfight against another user.',
description: 'Engage in a western gunfight against another user. High noon.',
guildOnly: true,
args: [
{
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = class HangmanCommand extends Command {
name: 'hangman',
group: 'games',
memberName: 'hangman',
description: 'Play a game of hangman.'
description: 'Prevent a man from being hanged by guessing a word as fast as you can.'
});
this.playing = new Set();
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = class HungerGamesCommand extends Command {
aliases: ['hunger-games-simulator', 'brant-steele'],
group: 'games',
memberName: 'hunger-games',
description: 'Simulate a Hunger Games match.',
description: 'Simulate a Hunger Games match with up to 24 tributes.',
args: [
{
key: 'tributes',
+2 -2
View File
@@ -6,12 +6,12 @@ module.exports = class LotteryCommand extends Command {
name: 'lottery',
group: 'games',
memberName: 'lottery',
description: 'Attempt to win the lottery, with a 1 in 100 chance of winning.'
description: 'Attempt to win the lottery, with a 1 in 1000 chance of winning.'
});
}
run(msg) {
const lottery = Math.floor(Math.random() * 100) + 1;
const lottery = Math.floor(Math.random() * 1000) + 1;
if (lottery === 1) return msg.reply('Nice job! 10/10! You deserve some cake!');
return msg.reply('Nope, sorry, you lost.');
}
@@ -17,7 +17,7 @@ module.exports = class MathGameCommand extends Command {
name: 'math-game',
aliases: ['math-quiz', 'math-test'],
group: 'games',
memberName: 'math-game',
memberName: 'math',
description: 'See how fast you can answer a math problem in a given time limit.',
args: [
{
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = class TicTacToeCommand extends Command {
name: 'tic-tac-toe',
group: 'games',
memberName: 'tic-tac-toe',
description: 'Play a game of tic-tac-toe.',
description: 'Play a game of tic-tac-toe with another user.',
args: [
{
key: 'opponent',
@@ -17,7 +17,7 @@ module.exports = class TypingGameCommand extends Command {
name: 'typing-game',
aliases: ['typing-quiz', 'typing-test'],
group: 'games',
memberName: 'typing-game',
memberName: 'typing',
description: 'See how fast you can type a sentence in a given time limit.',
args: [
{
+2 -2
View File
@@ -21,8 +21,8 @@ module.exports = class WizardConventionCommand extends Command {
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
await msg.say('You will need at least 2 more players, at maximum 15. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 15, 3);
await msg.say('You will need at least 2 more players, at maximum 10. To join, type `join game`.');
const awaitedPlayers = await awaitPlayers(msg, 10, 3);
if (!awaitedPlayers) {
this.playing.delete(msg.channel.id);
return msg.say('Game could not be started...');