From 21c2efd80640d2c00b7f5f98bca27c3ae7139614 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 21 Mar 2024 20:52:27 -0400 Subject: [PATCH] Fix chuck norris --- commands/random-res/charlie-charlie.js | 39 -------------------------- commands/random-res/chuck-norris.js | 24 ++++------------ 2 files changed, 5 insertions(+), 58 deletions(-) delete mode 100644 commands/random-res/charlie-charlie.js diff --git a/commands/random-res/charlie-charlie.js b/commands/random-res/charlie-charlie.js deleted file mode 100644 index d72dc468..00000000 --- a/commands/random-res/charlie-charlie.js +++ /dev/null @@ -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' ? '\\' : ' '} - \`\`\` - `); - } -}; diff --git a/commands/random-res/chuck-norris.js b/commands/random-res/chuck-norris.js index bf6fc0db..31fb37a7 100644 --- a/commands/random-res/chuck-norris.js +++ b/commands/random-res/chuck-norris.js @@ -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!`); }