diff --git a/README.md b/README.md index b8082c3d..e5c1bbca 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,6 @@ Total: 548 * **superpower:** Responds with a random superpower. * **the-onion:** Responds with a random "The Onion" article. * **this-for-that:** So, basically, it's like a bot command for this dumb meme. -* **will-you-press-the-button:** Responds with a random "Will You Press The Button?" dilemma. * **word:** Responds with a random word. * **would-you-rather:** Responds with a random "Would you rather ...?" question. * **xiao-fact:** Responds with a random fact about Xiao. @@ -570,6 +569,7 @@ Total: 548 * **typing-test:** See how fast you can type a sentence in a given time limit. * **waldo:** Try to find Waldo with spoiler tags! * **whos-that-pokemon:** Guess who that Pokémon is. +* **will-you-press-the-button:** Responds with a random "Will You Press The Button?" dilemma. ### Multi-Player Games: @@ -1735,7 +1735,7 @@ here. * time ([Time Zone Data](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) * wikipedia ([API](https://en.wikipedia.org/w/api.php)) - [Will You Press The Button?](https://willyoupressthebutton.com/) - * will-you-press-the-button (Dilemma Data) + * will-you-press-the-button (API) - [World of Tanks](https://worldoftanks.com/) * simp ([Image](https://worldoftanks.com/es-ar/content/silver-league/open-standings/)) - [www.aljanh.net](http://www.aljanh.net/) diff --git a/commands/random-res/will-you-press-the-button.js b/commands/games-sp/will-you-press-the-button.js similarity index 75% rename from commands/random-res/will-you-press-the-button.js rename to commands/games-sp/will-you-press-the-button.js index b5e8276c..06cfcbc4 100644 --- a/commands/random-res/will-you-press-the-button.js +++ b/commands/games-sp/will-you-press-the-button.js @@ -8,7 +8,7 @@ module.exports = class WillYouPressTheButtonCommand extends Command { super(client, { name: 'will-you-press-the-button', aliases: ['press-the-button', 'button', 'wyptb', 'press-button'], - group: 'random-res', + group: 'games-sp', memberName: 'will-you-press-the-button', description: 'Responds with a random "Will You Press The Button?" dilemma.', credit: [ @@ -22,21 +22,31 @@ module.exports = class WillYouPressTheButtonCommand extends Command { } async run(msg) { + 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 dilemma = await this.fetchDilemma(); await msg.reply(stripIndents` - **${dilemma.txt1}** but **${dilemma.txt2}** Will you press the button? + **${dilemma.txt1}** but **${dilemma.txt2}** + + Will you press the button? _Respond with [y]es or [n]o to continue._ `); const verification = await verify(msg.channel, msg.author); - if (verification === 0) return msg.reply('No response? Too bad.'); + if (verification === 0) { + this.client.games.delete(msg.channel.id); + return msg.reply('No response? Too bad.'); + } await this.postResponse(dilemma.id, verification); const totalVotes = dilemma.yes + dilemma.no; + this.client.games.delete(msg.channel.id); return msg.reply(stripIndents` **${Math.round(((verification ? dilemma.yes : dilemma.no) / totalVotes) * 100)}%** of people agree! Yes ${dilemma.yes} - ${dilemma.no} No `); } catch (err) { + this.client.games.delete(msg.channel.id); return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } }