2020-10-23 01:34:20 +00:00
|
|
|
const fetch = require("node-fetch")
|
|
|
|
const { MessageEmbed } = require('discord.js')
|
2020-01-25 10:02:43 +00:00
|
|
|
exports.run = async (client, message) => {
|
2020-10-23 01:34:20 +00:00
|
|
|
message.channel.startTyping();
|
|
|
|
try {
|
|
|
|
fetch('https://garfield-comics.glitch.me/~SRoMG/?date=xxxx')
|
|
|
|
.then(res => res.json())
|
|
|
|
.then(json => {
|
|
|
|
const embed = new MessageEmbed()
|
|
|
|
.setTitle(`${json.data.name} (No. ${json.data.number})`)
|
|
|
|
.setColor(client.embedColour(message))
|
|
|
|
.setURL('https://www.mezzacotta.net/garfield/?comic=' + json.data.number)
|
|
|
|
.setImage(json.data.image.src);
|
|
|
|
message.channel.send(embed)
|
|
|
|
});
|
|
|
|
message.channel.stopTyping();
|
|
|
|
} catch (err) {
|
|
|
|
message.channel.send(`<:error:466995152976871434> An error has occurred: ${err}`)
|
|
|
|
message.channel.stopTyping();
|
|
|
|
};
|
2020-01-25 10:02:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.conf = {
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: [],
|
|
|
|
permLevel: "User",
|
|
|
|
requiredPerms: ["ATTACH_FILES"]
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.help = {
|
|
|
|
name: "garfield",
|
|
|
|
category: "Fun",
|
|
|
|
description: "Sends you a random garfield comic",
|
|
|
|
usage: "garfield"
|
|
|
|
};
|