Box Choosing Command

This commit is contained in:
Daniel Odendahl Jr
2018-07-10 00:46:06 +00:00
parent ca477316f3
commit 313f9c46de
5 changed files with 104 additions and 5 deletions
-3
View File
@@ -2,6 +2,3 @@ node_modules/
package-lock.json
logs/
*.log
commands/games/box-choosing.js
assets/json/box-choosing.json
+2 -1
View File
@@ -15,7 +15,7 @@ You can invite the bot to your server using
Be sure to also join the [home server](https://discord.gg/sbMe32W) for
information and support.
## Commands (291)
## Commands (292)
### Utility:
* **prefix**: Shows or sets the command prefix.
@@ -195,6 +195,7 @@ information and support.
* **akinator**: Think about a real or fictional character, I will try to guess who it is.
* **balloon-pop**: Don't let yourself be the last one to pump the balloon before it pops!
* **battle**: Engage in a turn-based battle against another user or the AI.
* **box-choosing**: Do you believe that there are choices in life? Taken from Higurashi Chapter 4.
* **captcha-quiz**: Try to guess what the captcha says.
* **chance**: Attempt to win with a 1 in 1000 (or your choice) chance of winning.
* **emoji-emoji-revolution**: Can you type arrow emoji faster than anyone else has ever typed them before?
+42
View File
@@ -0,0 +1,42 @@
{
"before": [
"Do you believe that there are choices in life?\nThere are many people who lament the following:\nIf there only existed points in life where there were clear choices to make, we would be able to scrutinize those carefully and make decisions that would lead us to a better future.\n\nEvery time I hear people lament as such, I cast it off as a rather trivial worry.\nEven if you were given a clear choice, it wouldn't be meaningful at all, and there wouldn't be any such path to a better future.",
"...Is this hard to understand?\nThen let's pretend that in front of you there are two strange boxes.\n\nIn other words, you have two clear choices.\nDo you open the red box, or the blue box?",
"A lot of things would be uncertain even with that choice, wouldn't they?\n\nIf you don't have the option of opening neither, then your choice boils down to the natural impulse of opening the box that holds the better result for you.\nThen, after examining the shape and features of each, and pondering a great many things, you have to pick either the red or the blue.\n\n...If this was you, which box would you open?",
"Red or blue?\n...If you were to go by their traditional meanings, then red would be a dangerous, threatening color.\nHowever, that doesn't automatically mean that it would be calm and relaxing inside the blue box, either.\nIn fact, it might even be that the colors are a trap, make you wary of the red box and have you open the blue.",
"A trap?\n...Could it be the contents of the box aren't a reward, but rather a penalty?\n\nSee...? Now you're at a loss.\nYou're so conflicted over the choice between red and blue that you've started wishing there was an option to open neither and just leave.",
"But there isn't. You have to open either the red box or the blue box.\nOh, I forgot to say this, but if you choose one box, the other will disappear.\nSo you'll never know the contents of box you don't open. I'll just put that that rule at the end there for you.",
"Now. Why don't you choose?\nThe red box, or the blue box?\n\n...It's all right, you won't lose anything by picking either one. ...Come on now.",
{
"text": "Open the red box or the blue box?",
"options": ["red", "blue", "red box", "blue box"],
"paths": ["red", "blue", "red", "blue"]
}
],
"red": [
"Have you thought about it?\nIn the end, you chose this color, didn't you?\n\n...As soon as you chose, the other box disappeared.\nSo you can give up on the contents of that one, okay?\nThat's the rule.\n\nNow, open up the box you chose.",
"Inside the box there was... a piece of caramel.",
"...I know you're a little disappointed.\n\nWell that's only natural.\nNo matter how you look at it, it looks like you drew the dud.",
"The correct box might have had a bar of chocolate in it, for all you know.\nNo, in fact, something incredible like a pair of tickets to Hawaii might have been in there.",
"But even if you wanted to verify that, the other box has already disappeared.\nThere's no way you can check now.\n\nBut if you think about it from an optimistic point of view...\nJust maybe... the other box was empty, and this box was the winner.\n\nAnd being satisfied (or perhaps not) with such a cheap prize, you pop it into your mouth and start chewing it happily.",
"So, what do you think in the end?\nIf you were given a second chance, would you try to open the other box?\n...But unfortunately, the chance to choose between the red box or the blue box has come and gone, never to be seen again.\nThe chance to change your selection will never come.",
"Don't your parents often say: Every choice you make in life only happens once, so choose carefully?\nHee hee hee...\n\nSee? Choices aren't that great after all. ...Aren't you a little disillusioned now? Ahhahahahahaha...",
{
"text": "Thanks for playing! If you liked this game, please consider supporting the developers of Higurashi!\n<https://store.steampowered.com/bundle/709/>",
"end": true
}
],
"blue": [
"Have you thought about it?\nIn the end, you chose this color, didn't you?\n\n...As soon as you chose, the other box disappeared.\nSo you can give up on the contents of that one, okay?\nThat's the rule.\n\nNow, open up the box you chose.",
"Inside the box there was... a stick of chewing gum.",
"...I know you're a little disappointed.\n\nWell that's only natural.\nNo matter how you look at it, it looks like you drew the dud.",
"The correct box might have had a bar of chocolate in it, for all you know.\nNo, in fact, something incredible like a pair of tickets to Hawaii might have been in there.",
"But even if you wanted to verify that, the other box has already disappeared.\nThere's no way you can check now.\n\nBut if you think about it from an optimistic point of view...\nJust maybe... the other box was empty, and this box was the winner.\n\nAnd being satisfied (or perhaps not) with such a cheap prize, you pop it into your mouth and start chewing it happily.",
"So, what do you think in the end?\nIf you were given a second chance, would you try to open the other box?\n...But unfortunately, the chance to choose between the red box or the blue box has come and gone, never to be seen again.\nThe chance to change your selection will never come.",
"Don't your parents often say: Every choice you make in life only happens once, so choose carefully?\nHee hee hee...\n\nSee? Choices aren't that great after all. ...Aren't you a little disillusioned now? Ahhahahahahaha...",
{
"text": "Thanks for playing! If you liked this game, please consider supporting the developers of Higurashi!\n<https://store.steampowered.com/bundle/709/>",
"end": true
}
]
}
+59
View File
@@ -0,0 +1,59 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
const { verify } = require('../../util/Util');
const script = require('../../assets/json/box-choosing');
module.exports = class BoxChoosingCommand extends Command {
constructor(client) {
super(client, {
name: 'box-choosing',
aliases: ['box-choose', 'boxes'],
group: 'games',
memberName: 'box-choosing',
description: 'Do you believe that there are choices in life? Taken from Higurashi Chapter 4.'
});
this.playing = new Set();
}
async run(msg) {
if (this.playing.has(msg.channel.id)) return msg.reply('Only one game may be occurring per channel.');
this.playing.add(msg.channel.id);
try {
let i = 0;
let path = 'before';
while (true) { // eslint-disable-line no-constant-condition
const line = script[path][i];
if (line.end) {
this.playing.delete(msg.channel.id);
return msg.say(line.text);
} else {
await msg.say(typeof line === 'object' ? line.text : stripIndents`
${line}
_Proceed?_
`);
}
if (line.options) {
const filter = res => res.author.id === msg.author.id && line.options.includes(res.content.toLowerCase());
const choose = await msg.channel.awaitMessages(filter, {
max: 1,
time: 120000
});
if (!choose.size) break;
path = line.paths[line.options.indexOf(choose.first().content.toLowerCase())];
i = 0;
} else {
const verification = await verify(msg.channel, msg.author, 120000);
if (!verification) break;
i++;
}
}
this.playing.delete(msg.channel.id);
return msg.say('See you soon!');
} catch (err) {
this.playing.delete(msg.channel.id);
throw err;
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "84.1.3",
"version": "84.2.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {