Charlie Charlie Challenge Command

This commit is contained in:
Daniel Odendahl Jr
2017-10-10 13:05:45 +00:00
parent e5747a4bb7
commit 14ef082a07
4 changed files with 47 additions and 5 deletions
+4 -2
View File
@@ -36,14 +36,16 @@ module.exports = class HangmanCommand extends Command {
const incorrect = [];
const display = '_'.repeat(word.length).split('');
while (word.length !== confirmation.length && points < 7) {
await msg.code(null, stripIndents`
await msg.say(stripIndents`
The word is: ${display.join(' ')}. Which letter do you choose?
\`\`\`
___________
| |
| ${points > 0 ? 'O' : ''}
| ${points > 2 ? '—' : ' '}${points > 1 ? '|' : ''}${points > 3 ? '—' : ''}
| ${points > 4 ? '/' : ''} ${points > 5 ? '\\' : ''}
===========
The word is: ${display.join(' ')}. Which letter do you choose?
\`\`\`
`);
const guess = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
+4 -2
View File
@@ -42,14 +42,16 @@ module.exports = class TicTacToeCommand extends Command {
while (!winner && taken.length < 9) {
const user = userTurn ? msg.author : opponent;
const sign = userTurn ? 'X' : 'O';
await msg.code(null, stripIndents`
await msg.code(stripIndents`
${user}, which side do you pick?
\`\`\`
${sides[0]} | ${sides[1]} | ${sides[2]}
—————————
${sides[3]} | ${sides[4]} | ${sides[5]}
—————————
${sides[6]} | ${sides[7]} | ${sides[8]}
\`\`\`
`);
await msg.say(`${user}, which side do you pick?`);
const turn = await msg.channel.awaitMessages(res => res.author.id === user.id, {
max: 1,
time: 30000
@@ -0,0 +1,38 @@
const { Command } = require('discord.js-commando');
const { stripIndent } = require('common-tags');
const answers = ['no1', 'yes1', 'no2', 'yes2'];
module.exports = class CharlieCharlieChallengeCommand extends Command {
constructor(client) {
super(client, {
name: 'charlie-charlie-challenge',
aliases: ['charlie-charlie'],
group: 'random-res',
memberName: 'charlie-charlie-challenge',
description: 'Asks your question to Charlie.',
args: [
{
key: 'question',
prompt: 'What do you want to ask Charlie?',
type: 'string'
}
]
});
}
run(msg, { question }) {
const answer = answers[Math.floor(Math.random() * answers.length)];
return msg.say(stripIndent`
Question: ${question}
\`\`\`
${answer === 'no1' ? '\\' : ' '} | ${answer === 'yes1' ? '/' : ' '}
NO ${answer === 'no1' ? '\\' : ' '} | ${answer === 'yes1' ? '/' : ' '}YES
${answer === 'no1' ? '\\' : ' '}|${answer === 'yes1' ? '/' : ' '}
----------------
${answer === 'yes2' ? '/' : ' '}|${answer === 'no2' ? '\\' : ' '}
YES${answer === 'yes2' ? '/' : ' '} | ${answer === 'no2' ? '\\' : ' '}NO
${answer === 'yes2' ? '/' : ' '} | ${answer === 'no2' ? '\\' : ' '}
\`\`\`
`);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "46.2.1",
"version": "46.3.0",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {