mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 00:08:06 +02:00
ISS, People in Space, and Adorable Commands
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class AdorableCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'adorable',
|
||||
aliases: ['adorable-avatar'],
|
||||
group: 'image-edit',
|
||||
memberName: 'adorable',
|
||||
description: 'Creates an adorable avatar based on the text you provide.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Adorable Avatars',
|
||||
url: 'http://avatars.adorable.io/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text should be used for generation?',
|
||||
type: 'string',
|
||||
parse: text => encodeURIComponent(text)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
try {
|
||||
const { body } = await request.get(`https://api.adorable.io/avatars/285/${text}.png`);
|
||||
return msg.say({ files: [{ attachment: body, name: 'adorable.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user