diff --git a/commands/games-sp/blackjack.js b/commands/games-sp/blackjack.js index 52d8f116..81013f61 100644 --- a/commands/games-sp/blackjack.js +++ b/commands/games-sp/blackjack.js @@ -3,6 +3,8 @@ const { stripIndents } = require('common-tags'); const { shuffle, verify } = require('../../util/Util'); const suits = ['♣', '♥', '♦', '♠']; const faces = ['Jack', 'Queen', 'King']; +const hitWords = ['hit', 'hit me']; +const standWords = ['stand']; module.exports = class BlackjackCommand extends Command { constructor(client) { @@ -62,7 +64,7 @@ module.exports = class BlackjackCommand extends Command { _Hit?_ `); - const hit = await verify(msg.channel, msg.author); + const hit = await verify(msg.channel, msg.author, { otherYes: hitWords, otherNo: standWords }); if (hit) { const card = this.draw(msg.channel, playerHand); const total = this.calculate(playerHand); diff --git a/commands/games-sp/box-choosing.js b/commands/games-sp/box-choosing.js index 7d7e7787..96929526 100644 --- a/commands/games-sp/box-choosing.js +++ b/commands/games-sp/box-choosing.js @@ -72,7 +72,7 @@ module.exports = class BoxChoosingCommand extends Command { path += pick; i = 0; } else { - const verification = await verify(msg.channel, msg.author, 120000); + const verification = await verify(msg.channel, msg.author, { time: 120000 }); if (!verification) { end = true; break; diff --git a/commands/games-sp/hunger-games.js b/commands/games-sp/hunger-games.js index d7013774..57903edd 100644 --- a/commands/games-sp/hunger-games.js +++ b/commands/games-sp/hunger-games.js @@ -66,7 +66,7 @@ module.exports = class HungerGamesCommand extends Command { } text += `\n\n_Proceed?_`; await msg.say(text); - const verification = await verify(msg.channel, msg.author, 120000); + const verification = await verify(msg.channel, msg.author, { time: 120000 }); if (!verification) { this.client.games.delete(msg.channel.id); return msg.say('See you next time!'); diff --git a/package.json b/package.json index 5c28e663..fc9d2e57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.20.0", + "version": "112.20.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/util/Util.js b/util/Util.js index 1081bf79..7ed22f51 100644 --- a/util/Util.js +++ b/util/Util.js @@ -124,10 +124,11 @@ module.exports = class Util { return `[${title}](${url.replace(/\)/g, '%27')}, "${display}")`; } - static async verify(channel, user, time = 30000) { + static async verify(channel, user, { time = 30000, extraYes = [], extraNo = [] }) { const filter = res => { const value = res.content.toLowerCase(); - return (user ? res.author.id === user.id : true) && (yes.includes(value) || no.includes(value)); + return (user ? res.author.id === user.id : true) + && (yes.includes(value) || no.includes(value) || extraYes.includes(value) || extraNo.includes(value)); }; const verify = await channel.awaitMessages(filter, { max: 1, @@ -135,8 +136,8 @@ module.exports = class Util { }); if (!verify.size) return 0; const choice = verify.first().content.toLowerCase(); - if (yes.includes(choice)) return true; - if (no.includes(choice)) return false; + if (yes.includes(choice) || extraYes.includes(choice)) return true; + if (no.includes(choice) || extraNo.includes(choice)) return false; return false; }