Update cards against humanity/apples to apples

This commit is contained in:
Dragon Fire
2018-08-05 20:29:07 -04:00
parent 9f91ee2404
commit 96ade18b63
3 changed files with 17 additions and 15 deletions
+8 -7
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const { escapeMarkdown } = require('discord.js');
const { Collection, escapeMarkdown } = require('discord.js');
const { stripIndents } = require('common-tags');
const { shuffle, awaitPlayers } = require('../../util/Util');
const { greenCards, redCards } = require('../../assets/json/apples-to-apples');
@@ -52,15 +52,15 @@ module.exports = class ApplesToApplesCommand extends Command {
Sending DMs...
`);
const chosenCards = [];
for (const player of players.values()) {
const turns = players.map(async player => {
if (player.hand.size < 11) {
const valid = redCards.filter(card => !player.hand.has(card));
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
}
if (player.user.id === czar.user.id) continue;
if (player.user.id === czar.user.id) return;
if (!player.hand.size) {
await player.user.send('You don\'t have enough cards!');
continue;
return;
}
const hand = Array.from(player.hand);
await player.user.send(stripIndents`
@@ -84,7 +84,7 @@ module.exports = class ApplesToApplesCommand extends Command {
});
if (!choice.size) {
await player.user.send('Skipping your turn...');
continue;
return;
}
if (chosen === '<Blank>') {
const handled = await this.handleBlank(player);
@@ -97,7 +97,8 @@ module.exports = class ApplesToApplesCommand extends Command {
card: chosen
});
await player.user.send(`Nice! Return to ${msg.channel} to await the results!`);
}
});
await Promise.all(turns);
if (!chosenCards.length) {
await msg.say('Hmm... No one even tried.');
break;
@@ -137,7 +138,7 @@ module.exports = class ApplesToApplesCommand extends Command {
}
async generatePlayers(list) {
const players = new Map();
const players = new Collection();
for (const user of list) {
const cards = new Set();
for (let i = 0; i < 5; i++) {
+8 -7
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const { escapeMarkdown } = require('discord.js');
const { Collection, escapeMarkdown } = require('discord.js');
const { stripIndents } = require('common-tags');
const { shuffle, awaitPlayers } = require('../../util/Util');
const { blackCards, whiteCards } = require('../../assets/json/cards-against-humanity');
@@ -53,15 +53,15 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
Sending DMs...
`);
const chosenCards = [];
for (const player of players.values()) {
const turns = players.map(async player => {
if (player.hand.size < 11) {
const valid = whiteCards.filter(card => !player.hand.has(card));
player.hand.add(valid[Math.floor(Math.random() * valid.length)]);
}
if (player.user.id === czar.user.id) continue;
if (player.user.id === czar.user.id) return;
if (player.hand.size < black.pick) {
await player.user.send('You don\'t have enough cards!');
continue;
return;
}
const hand = Array.from(player.hand);
await player.user.send(stripIndents`
@@ -86,7 +86,7 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
});
if (!choices.size || choices.size < black.pick) {
await player.user.send('Skipping your turn...');
continue;
return;
}
if (chosen.includes('<Blank>')) {
const handled = await this.handleBlank(player);
@@ -98,7 +98,8 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
cards: chosen
});
await player.user.send(`Nice! Return to ${msg.channel} to await the results!`);
}
});
await Promise.all(turns);
if (!chosenCards.length) {
await msg.say('Hmm... No one even tried.');
break;
@@ -138,7 +139,7 @@ module.exports = class CardsAgainstHumanityCommand extends Command {
}
async generatePlayers(list) {
const players = new Map();
const players = new Collection();
for (const user of list) {
const cards = new Set();
for (let i = 0; i < 5; i++) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "85.11.0",
"version": "85.11.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {