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