Fix chuck norris

This commit is contained in:
Dragon Fire
2024-03-21 20:52:27 -04:00
parent a5c84e4fb5
commit 21c2efd806
2 changed files with 5 additions and 58 deletions
-39
View File
@@ -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' ? '\\' : ' '}
\`\`\`
`);
}
};
+5 -19
View File
@@ -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!`);
}