mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 08:17:35 +02:00
Refactor roleplay commands, bro-hoof, meme, remove face, add dotenv support
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class CreateMemeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'create-meme',
|
||||
aliases: ['meme-generator', 'meme-gen'],
|
||||
group: 'image-edit',
|
||||
memberName: 'create-meme',
|
||||
description: 'Sends a meme with the text and background of your choice.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
args: [
|
||||
{
|
||||
key: 'type',
|
||||
prompt: 'What meme type do you want to use?',
|
||||
type: 'string',
|
||||
parse: type => encodeURIComponent(type)
|
||||
},
|
||||
{
|
||||
key: 'top',
|
||||
prompt: 'What should the top row of the meme to be?',
|
||||
type: 'string',
|
||||
max: 200,
|
||||
parse: top => encodeURIComponent(top)
|
||||
},
|
||||
{
|
||||
key: 'bottom',
|
||||
prompt: 'What should the bottom row of the meme to be?',
|
||||
type: 'string',
|
||||
max: 200,
|
||||
parse: bottom => encodeURIComponent(bottom)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { type, top, bottom }) {
|
||||
try {
|
||||
const search = await request.get(`https://memegen.link/api/search/${type}`);
|
||||
if (!search.body.length) return msg.say('Could not find any results.');
|
||||
const { body } = await request.get(search.body[0].template.blank.replace(/\/_/, `/${top}/${bottom}`));
|
||||
return msg.say({ files: [{ attachment: body, name: 'meme.jpg' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user