This commit is contained in:
Dragon Fire
2020-10-12 16:46:06 -04:00
parent 66ebace5b1
commit 2053ec8ce0
2 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -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/)
@@ -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!`);
}
}