mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Inspiration Command
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user