mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-04 15:56:52 +02:00
34 lines
826 B
JavaScript
34 lines
826 B
JavaScript
const Command = require('../../structures/Command');
|
|
const request = require('node-superfetch');
|
|
|
|
module.exports = class InspirationCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'inspiration',
|
|
aliases: ['inspire', 'inspirobot'],
|
|
group: 'random-img',
|
|
memberName: 'inspiration',
|
|
description: 'Responds with a randomly generated inspiration.',
|
|
clientPermissions: ['ATTACH_FILES'],
|
|
credit: [
|
|
{
|
|
name: 'InspiroBot',
|
|
url: 'https://inspirobot.me/',
|
|
reason: 'API'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
async run(msg) {
|
|
try {
|
|
const { text } = await request
|
|
.get('https://inspirobot.me/api')
|
|
.query({ generate: true });
|
|
return msg.say({ files: [text] });
|
|
} catch (err) {
|
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
|
}
|
|
}
|
|
};
|