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 { 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!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "44.4.2",
"version": "44.4.3",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {