Files
xiao/commands/image-edit/be-like-bill.js
T
Daniel Odendahl Jr db036990f9 Be Like Bill
2017-09-22 21:50:58 +00:00

39 lines
945 B
JavaScript

const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
module.exports = class BeLikeBillCommand extends Command {
constructor(client) {
super(client, {
name: 'be-like-bill',
aliases: ['be-like'],
group: 'image-edit',
memberName: 'be-like-bill',
description: 'Sends a "Be Like Bill" meme with the name of your choice.',
clientPermissions: ['ATTACH_FILES'],
args: [
{
key: 'name',
prompt: 'What should the name on the meme be?',
type: 'string',
default: 'Bill'
}
]
});
}
async run(msg, { name }) {
try {
const { body } = await snekfetch
.get('http://belikebill.azurewebsites.net/billgen-API.php')
.query({
default: 1,
name
});
return msg.say({ files: [{ attachment: body, name: 'be-like-bill.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};