forked from embee/woomy
		
	new garfield command
This commit is contained in:
		
							parent
							
								
									ef0e2d8594
								
							
						
					
					
						commit
						98255e73aa
					
				
					 2 changed files with 19 additions and 5 deletions
				
			
		| 
						 | 
					@ -10,7 +10,6 @@
 | 
				
			||||||
    "dblapi.js": "^2.4.1",
 | 
					    "dblapi.js": "^2.4.1",
 | 
				
			||||||
    "discord.js": "^12.4.0",
 | 
					    "discord.js": "^12.4.0",
 | 
				
			||||||
    "enmap": "^5.8.0",
 | 
					    "enmap": "^5.8.0",
 | 
				
			||||||
    "garfield": "^1.1.2",
 | 
					 | 
				
			||||||
    "hastebin-gen": "^2.0.5",
 | 
					    "hastebin-gen": "^2.0.5",
 | 
				
			||||||
    "moment": "^2.29.1",
 | 
					    "moment": "^2.29.1",
 | 
				
			||||||
    "moment-duration-format": "^2.3.2",
 | 
					    "moment-duration-format": "^2.3.2",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,23 @@
 | 
				
			||||||
const garfield = require("garfield");
 | 
					const fetch = require("node-fetch")
 | 
				
			||||||
 | 
					const { MessageEmbed } = require('discord.js')
 | 
				
			||||||
exports.run = async (client, message) => {  
 | 
					exports.run = async (client, message) => {  
 | 
				
			||||||
  message.channel.send({ files: [garfield.random()] }).catch(() => message.channel.send(
 | 
					  message.channel.startTyping();
 | 
				
			||||||
    "<:error:466995152976871434> API didn't respond, try again in a few seconds."
 | 
					  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();
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.conf = {
 | 
					exports.conf = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue