mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
Fix chuck norris
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
const Command = require('../../framework/Command');
|
||||
const { stripIndent } = require('common-tags');
|
||||
const answers = ['yes', 'no'];
|
||||
|
||||
module.exports = class CharlieCharlieCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'charlie-charlie',
|
||||
aliases: ['charlie-charlie-challenge'],
|
||||
group: 'random-res',
|
||||
memberName: 'charlie-charlie',
|
||||
description: 'Asks your question to Charlie.',
|
||||
args: [
|
||||
{
|
||||
key: 'question',
|
||||
prompt: 'What do you want to ask Charlie?',
|
||||
type: 'string',
|
||||
max: 1900
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { question }) {
|
||||
const answer = answers[Math.floor(Math.random() * answers.length)];
|
||||
return msg.say(stripIndent`
|
||||
_${question}_
|
||||
\`\`\`
|
||||
${answer === 'no' ? '\\' : ' '} | ${answer === 'yes' ? '/' : ' '}
|
||||
NO ${answer === 'no' ? '\\' : ' '} | ${answer === 'yes' ? '/' : ' '}YES
|
||||
${answer === 'no' ? '\\' : ' '}|${answer === 'yes' ? '/' : ' '}
|
||||
————————————————
|
||||
${answer === 'yes' ? '/' : ' '}|${answer === 'no' ? '\\' : ' '}
|
||||
YES${answer === 'yes' ? '/' : ' '} | ${answer === 'no' ? '\\' : ' '}NO
|
||||
${answer === 'yes' ? '/' : ' '} | ${answer === 'no' ? '\\' : ' '}
|
||||
\`\`\`
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -16,18 +16,10 @@ module.exports = class ChuckNorrisCommand extends Command {
|
||||
reason: 'Himself'
|
||||
},
|
||||
{
|
||||
name: 'The Internet Chuck Norris Database',
|
||||
url: 'http://www.icndb.com/',
|
||||
name: 'chucknorris.io',
|
||||
url: 'https://api.chucknorris.io/',
|
||||
reason: 'API',
|
||||
reasonURL: 'http://www.icndb.com/api/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'name',
|
||||
prompt: 'What would you like the name to be?',
|
||||
type: 'string',
|
||||
default: 'Chuck'
|
||||
reasonURL: 'https://api.chucknorris.io/'
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -35,14 +27,8 @@ module.exports = class ChuckNorrisCommand extends Command {
|
||||
|
||||
async run(msg, { name }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://api.icndb.com/jokes/random')
|
||||
.query({
|
||||
escape: 'javascript',
|
||||
firstName: name,
|
||||
exclude: msg.channel.nsfw ? '' : '[explicit]'
|
||||
});
|
||||
return msg.say(body.value.joke);
|
||||
const { body } = await request.get('https://api.chucknorris.io/jokes/random');
|
||||
return msg.say(body.value);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user