2020-10-28 07:01:49 +00:00
|
|
|
const fetch = require('node-fetch');
|
|
|
|
|
|
|
|
module.exports = class {
|
|
|
|
constructor (name, category) {
|
|
|
|
this.name = name,
|
|
|
|
this.category = category,
|
|
|
|
this.enabled = true,
|
|
|
|
this.devOnly = false,
|
|
|
|
this.aliases = ['inspire'],
|
|
|
|
this.userPerms = [],
|
|
|
|
this.botPerms = [],
|
|
|
|
this.cooldown = 2000,
|
|
|
|
this.help = {
|
2020-10-29 08:20:45 +00:00
|
|
|
description: 'Generates a random (and likely terrible) inspirational quote.',
|
|
|
|
arguments: '',
|
|
|
|
details: '',
|
2020-10-28 07:01:49 +00:00
|
|
|
examples: null
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
run (client, message, args, data) { //eslint-disable-line no-unused-vars
|
|
|
|
message.channel.sendTyping();
|
|
|
|
try {
|
2021-02-26 02:16:47 +00:00
|
|
|
fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }})
|
2020-10-28 07:01:49 +00:00
|
|
|
.then(res => res.text())
|
|
|
|
.then(body => message.channel.createMessage(body));
|
|
|
|
} catch (err) {
|
2020-11-10 03:31:49 +00:00
|
|
|
message.channel.createMessage(`${client.emojis.botError} An error has occurred: ${err}`);
|
2020-10-28 07:01:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|