mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 21:40:51 +02:00
Better cowsay
This commit is contained in:
@@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with
|
|||||||
The bot is no longer available for invite. You can self-host the bot, or use her
|
The bot is no longer available for invite. You can self-host the bot, or use her
|
||||||
on the [home server](https://discord.gg/sbMe32W).
|
on the [home server](https://discord.gg/sbMe32W).
|
||||||
|
|
||||||
## Commands (322)
|
## Commands (321)
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
* **eval:** Executes JavaScript code.
|
* **eval:** Executes JavaScript code.
|
||||||
@@ -308,7 +308,6 @@ on the [home server](https://discord.gg/sbMe32W).
|
|||||||
* **brony-speak:** Converts text to brony speak.
|
* **brony-speak:** Converts text to brony speak.
|
||||||
* **clap:** Sends 👏 text 👏 like 👏 this.
|
* **clap:** Sends 👏 text 👏 like 👏 this.
|
||||||
* **cow-say:** Makes a cow say your text.
|
* **cow-say:** Makes a cow say your text.
|
||||||
* **cow-think:** Makes a cow think your text.
|
|
||||||
* **cursive:** Converts text to cursive.
|
* **cursive:** Converts text to cursive.
|
||||||
* **dvorak:** Converts text to Dvorak encoding.
|
* **dvorak:** Converts text to Dvorak encoding.
|
||||||
* **embed:** Sends text in an embed.
|
* **embed:** Sends text in an embed.
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const cowsay = require('cowsay');
|
const request = require('node-superfetch');
|
||||||
const cowList = require('cowsay/lib/cows');
|
|
||||||
const { list } = require('../../util/Util');
|
|
||||||
const cows = cowList.listSync();
|
|
||||||
cows.push('random');
|
|
||||||
|
|
||||||
module.exports = class CowSayCommand extends Command {
|
module.exports = class CowSayCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -12,37 +8,28 @@ module.exports = class CowSayCommand extends Command {
|
|||||||
group: 'text-edit',
|
group: 'text-edit',
|
||||||
memberName: 'cow-say',
|
memberName: 'cow-say',
|
||||||
description: 'Makes a cow say your text.',
|
description: 'Makes a cow say your text.',
|
||||||
details: `**Types:** ${cows.join(', ')}`,
|
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'text',
|
key: 'text',
|
||||||
prompt: 'What text would you like the cow to say?',
|
prompt: 'What text would you like the cow to say?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 500
|
max: 1000
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'type',
|
|
||||||
prompt: `What type of cow would you like to use? Either ${list(cows, 'or')}.`,
|
|
||||||
type: 'string',
|
|
||||||
default: 'default',
|
|
||||||
validate: type => {
|
|
||||||
if (cows.includes(type.toLowerCase()) || type.toLowerCase() === 'cow') return true;
|
|
||||||
return `Invalid type, please enter either ${list(cows, 'or')}.`;
|
|
||||||
},
|
|
||||||
parse: type => {
|
|
||||||
if (type.toLowerCase() === 'cow') return 'default';
|
|
||||||
return type.toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(msg, { text, type }) {
|
async run(msg, { text }) {
|
||||||
return msg.code(null, cowsay.say({
|
try {
|
||||||
text,
|
const { body } = request
|
||||||
f: type,
|
.get('http://cowsay.morecode.org/say')
|
||||||
r: type === 'random'
|
.query({
|
||||||
}));
|
message: text,
|
||||||
|
format: 'json'
|
||||||
|
});
|
||||||
|
return msg.code(null, body.cow);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
const Command = require('../../structures/Command');
|
|
||||||
const cowsay = require('cowsay');
|
|
||||||
const cowList = require('cowsay/lib/cows');
|
|
||||||
const { list } = require('../../util/Util');
|
|
||||||
const cows = cowList.listSync();
|
|
||||||
cows.push('random');
|
|
||||||
|
|
||||||
module.exports = class CowThinkCommand extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: 'cow-think',
|
|
||||||
group: 'text-edit',
|
|
||||||
memberName: 'cow-think',
|
|
||||||
description: 'Makes a cow think your text.',
|
|
||||||
details: `**Types:** ${cows.join(', ')}`,
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
key: 'text',
|
|
||||||
prompt: 'What text would you like the cow to think?',
|
|
||||||
type: 'string',
|
|
||||||
max: 500
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'type',
|
|
||||||
prompt: `What type of cow would you like to use? Either ${list(cows, 'or')}.`,
|
|
||||||
type: 'string',
|
|
||||||
default: 'default',
|
|
||||||
validate: type => {
|
|
||||||
if (cows.includes(type.toLowerCase()) || type.toLowerCase() === 'cow') return true;
|
|
||||||
return `Invalid type, please enter either ${list(cows, 'or')}.`;
|
|
||||||
},
|
|
||||||
parse: type => {
|
|
||||||
if (type.toLowerCase() === 'cow') return 'default';
|
|
||||||
return type.toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
run(msg, { text, type }) {
|
|
||||||
return msg.code(null, cowsay.think({
|
|
||||||
text,
|
|
||||||
f: type,
|
|
||||||
r: type === 'random'
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "91.15.0",
|
"version": "92.0.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -35,7 +35,6 @@
|
|||||||
"canvas": "^2.0.0-alpha.17",
|
"canvas": "^2.0.0-alpha.17",
|
||||||
"cheerio": "^1.0.0-rc.2",
|
"cheerio": "^1.0.0-rc.2",
|
||||||
"common-tags": "^1.8.0",
|
"common-tags": "^1.8.0",
|
||||||
"cowsay": "^1.3.1",
|
|
||||||
"custom-translate": "^2.2.7",
|
"custom-translate": "^2.2.7",
|
||||||
"discord.js": "github:discordjs/discord.js",
|
"discord.js": "github:discordjs/discord.js",
|
||||||
"discord.js-commando": "github:discordjs/Commando",
|
"discord.js-commando": "github:discordjs/Commando",
|
||||||
|
|||||||
Reference in New Issue
Block a user