This commit is contained in:
Daniel Odendahl Jr
2017-11-09 00:02:59 +00:00
parent 819db49057
commit b6afded306
125 changed files with 743 additions and 289 deletions
+36
View File
@@ -0,0 +1,36 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
module.exports = class ChuckNorrisCommand extends Command {
constructor(client) {
super(client, {
name: 'chuck-norris',
aliases: ['chuck', 'norris'],
group: 'random',
memberName: 'chuck-norris',
description: 'Responds with a random Chuck Norris joke.',
args: [
{
key: 'name',
prompt: 'What would you like the name to be?',
type: 'string',
default: 'Chuck'
}
]
});
}
async run(msg, { name }) {
try {
const { body } = await snekfetch
.get('http://api.icndb.com/jokes/random')
.query({
escape: 'javascript',
firstName: name
});
return msg.say(body.value.joke);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};