Add an option to send picutres of lucifer (my own cat)

This commit is contained in:
Wessel T
2019-02-03 15:34:26 +01:00
parent ebfcfdf76e
commit 938afbd631
2 changed files with 12 additions and 8 deletions

View File

@@ -14,7 +14,7 @@ translation :
error :
- '$[author:mention] **>** Er is een fout opgetreden tijdens het uitvoeren van dit commando'
- 'Als dit probleem zich blijft voordoen, kunt u overwegen lid te worden van *** https: //discord.gg/SV7DAE9*** en uw probleem daar te plaatsen'
- 'Als dit probleem zich blijft voordoen, kunt u overwegen lid te worden van *** https://discord.gg/SV7DAE9*** en uw probleem daar te plaatsen'
- '```ini'
- '[ Fout Informatie ]'
- 'Code = "$[err:code]"'

View File

@@ -1,14 +1,15 @@
const { DiscordCommand } = require('../../../core');
const w = require('wumpfetch');
const l = require('larg');
module.exports = class Cat extends DiscordCommand {
constructor(bot) {
super(bot, {
name : 'cat',
syntax : 'cat',
syntax : 'cat [--lucifer]',
aliases : [ 'kitten' ],
argument : [],
argument : [ '[--lucifer]' ],
description: 'Get a random cat',
hidden : false,
@@ -21,19 +22,22 @@ module.exports = class Cat extends DiscordCommand {
});
}
async execute(msg) {
async execute(msg, args) {
let img = l(args)['lucifer'] ? `https://wessel.meek.moe/lucifer/${Math.floor(Math.random() * 37)}.jpg` : 'https://aws.random.cat/meow'
const message = await msg.channel.createMessage(this.localize(msg.author.locale['image']['fetching']));
let img = await w('https://aws.random.cat/meow', { headers: { 'User-Agent': this.bot.ua } }).send();
if (img === 'https://aws.random.cat/meow') {
img = await w(img, { headers: { 'User-Agent': this.bot.ua } }).send();
img = img.json();
}
let res = await w('https://catfact.ninja/fact?max_length=1500', { headers: { 'User-Agent': this.bot.ua } }).send();
img = img.json();
res = res.json();
msg.channel.createMessage({
embed: {
color : this.bot.col['image']['cat'],
image : { url: img.file ? img.file : '' },
description: `${this.bot.emote('image', 'cat', '1')} *Random Fact* **>** ${res.fact}\n\n*[\`${msg.author.locale['image']['failed_cache']}\`](${img && img.file ? img.file : 'https://www.google.com/'})*`
image : { url: img.file ? img.file : img },
description: `${this.bot.emote('image', 'cat', '1')} *Random Fact* **>** ${res.fact}\n\n*[\`${msg.author.locale['image']['failed_cache']}\`](${img && img.file ? img.file : img})*`
}
});
message.delete();