diff --git a/commands/text-edit/cow-say.js b/commands/text-edit/cow-say.js index c3018669..9f52f4b2 100644 --- a/commands/text-edit/cow-say.js +++ b/commands/text-edit/cow-say.js @@ -1,5 +1,5 @@ const { Command } = require('discord.js-commando'); -const { stripIndent } = require('common-tags'); +const snekfetch = require('snekfetch'); module.exports = class CowSayCommand extends Command { constructor(client) { @@ -22,16 +22,17 @@ module.exports = class CowSayCommand extends Command { }); } - run(msg, { text }) { - return msg.code(null, - stripIndent` - < ${text} > - \\ ^__^ - \\ (oO)\\_______ - (__)\\ )\\/\\ - U ||----w | - || || - ` - ); + async run(msg, { text }) { + try { + const { body } = await snekfetch + .get('http://cowsay.morecode.org/say') + .query({ + message: text, + format: 'json' + }); + return msg.code(null, body.cow); + } catch (err) { + return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } } }; diff --git a/package.json b/package.json index b42848ad..afbd7a5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "44.4.2", + "version": "44.4.3", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {