From e0a2074617f1108e3099f529f00948679750e0c2 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 10 May 2020 17:27:24 -0400 Subject: [PATCH] Add player arg to guesspionage --- commands/games-mp/guesspionage.js | 19 ++++++++++++++----- package.json | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/commands/games-mp/guesspionage.js b/commands/games-mp/guesspionage.js index 340801aa..b6bb8b0b 100644 --- a/commands/games-mp/guesspionage.js +++ b/commands/games-mp/guesspionage.js @@ -36,16 +36,25 @@ module.exports = class GuesspionageCommand extends Command { reason: 'Question Data', reasonURL: 'https://www.trueachievements.com/forum/viewthread.aspx?tid=850920' } + ], + args: [ + { + key: 'players', + prompt: 'How many players are you expecting to have?', + type: 'integer', + min, + max + } ] }); } - async run(msg) { + async run(msg, { players }) { const current = this.client.games.get(msg.channel.id); if (current) return msg.reply(`Please wait until the current game of \`${current.name}\` is finished.`); this.client.games.set(msg.channel.id, { name: this.name }); try { - const awaitedPlayers = await this.awaitPlayers(msg); + const awaitedPlayers = await this.awaitPlayers(msg, players); if (!awaitedPlayers) { this.client.games.delete(msg.channel.id); return msg.say('Game could not be started...'); @@ -155,8 +164,8 @@ module.exports = class GuesspionageCommand extends Command { } } - async awaitPlayers(msg) { - await msg.say(`You will need at least 1 more player (at max ${max - 1}). To join, type \`join game\`.`); + async awaitPlayers(msg, players) { + await msg.say(`You will need at least 1 more player (at max ${players - 1}). To join, type \`join game\`.`); const joined = []; joined.push(msg.author.id); const filter = res => { @@ -167,7 +176,7 @@ module.exports = class GuesspionageCommand extends Command { res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null); return true; }; - const verify = await msg.channel.awaitMessages(filter, { max: max - 1, time: 30000 }); + const verify = await msg.channel.awaitMessages(filter, { max: players - 1, time: 30000 }); verify.set(msg.id, msg); if (verify.size < min) return false; return verify.map(player => player.author.id); diff --git a/package.json b/package.json index 84806206..2d6af875 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.8.6", + "version": "114.8.7", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {