MOSTI MPORTANT COMMAND HAS BEEN BROUGHT OVER
This commit is contained in:
parent
05e190aa11
commit
251733119c
1 changed files with 40 additions and 0 deletions
40
bot/commands/Fun/garfield.js
Normal file
40
bot/commands/Fun/garfield.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
const fetch = require('node-fetch');
|
||||
const Embed = require('../../util/embed');
|
||||
|
||||
module.exports = class {
|
||||
constructor (name, category) {
|
||||
this.name = name,
|
||||
this.category = category,
|
||||
this.enabled = true,
|
||||
this.devOnly = false,
|
||||
this.aliases = [],
|
||||
this.userPerms = [],
|
||||
this.botPerms = [],
|
||||
this.cooldown = 2000,
|
||||
this.help = {
|
||||
description: 'Sends you a strip from the best comic ever',
|
||||
usage: 'garfield <daily>',
|
||||
examples: '`garfield` - sends a random garfield comic strip\n`garfield daily` - sends the daily strip'
|
||||
};
|
||||
}
|
||||
|
||||
run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
||||
let date = 'xxxx';
|
||||
if (args[0] && args[0].toLowerCase() === 'daily') date = new Date();
|
||||
message.channel.sendTyping();
|
||||
try {
|
||||
fetch('https://garfield-comics.glitch.me/~SRoMG/?date=' + date)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
const embed = new Embed()
|
||||
.setTitle(`${json.data.name} (No. ${json.data.number})`)
|
||||
.setColor(client.functions.randomColour())
|
||||
.setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number)
|
||||
.setImage(json.data.image.src);
|
||||
message.channel.createMessage({ embed: embed });
|
||||
});
|
||||
} catch (err) {
|
||||
message.channel.send(`${client.constants.emojis.botError} An error has occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue