Improve cowsay

This commit is contained in:
dragonfire535
2017-10-05 07:26:09 -04:00
parent 464441f0e2
commit 910c45a844
2 changed files with 14 additions and 13 deletions
+13 -12
View File
@@ -1,5 +1,5 @@
const { Command } = require('discord.js-commando'); const { Command } = require('discord.js-commando');
const { stripIndent } = require('common-tags'); const snekfetch = require('snekfetch');
module.exports = class CowSayCommand extends Command { module.exports = class CowSayCommand extends Command {
constructor(client) { constructor(client) {
@@ -22,16 +22,17 @@ module.exports = class CowSayCommand extends Command {
}); });
} }
run(msg, { text }) { async run(msg, { text }) {
return msg.code(null, try {
stripIndent` const { body } = await snekfetch
< ${text} > .get('http://cowsay.morecode.org/say')
\\ ^__^ .query({
\\ (oO)\\_______ message: text,
(__)\\ )\\/\\ format: 'json'
U ||----w | });
|| || return msg.code(null, body.cow);
` } catch (err) {
); return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
} }
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiaobot", "name": "xiaobot",
"version": "44.4.2", "version": "44.4.3",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Shard.js", "main": "Shard.js",
"scripts": { "scripts": {