mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 13:56:25 +02:00
Updates
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user