mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 16:19:12 +02:00
Improve cowsay
This commit is contained in:
@@ -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
@@ -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": {
|
||||||
|
|||||||
Reference in New Issue
Block a user