mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 03:14:35 +02:00
23
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class BinaryCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'binary',
|
||||
group: 'text-edit',
|
||||
memberName: 'binary',
|
||||
description: 'Converts text to binary.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to binary?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (this.binary(text).length < 2000) return true;
|
||||
else return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = this.binary(text);
|
||||
return msg.say(converted);
|
||||
}
|
||||
|
||||
binary(text) {
|
||||
return unescape(encodeURIComponent(text)).split('').map((str) => {
|
||||
const converted = str.charCodeAt(0).toString(2);
|
||||
return `${'00000000'.slice(converted.length)}${converted}`;
|
||||
}).join('');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { stripIndent } = require('common-tags');
|
||||
|
||||
module.exports = class CowsayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cow-say',
|
||||
group: 'text-edit',
|
||||
memberName: 'cow-say',
|
||||
description: 'Converts text to cowsay.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like the cow to say?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (text.length < 1500) return true;
|
||||
else return 'Text must be under 1500 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
return msg.code(null,
|
||||
stripIndent`
|
||||
< ${text} >
|
||||
\\ ^__^
|
||||
\\ (oO)\\_______
|
||||
(__)\\ )\\/\\
|
||||
U ||----w |
|
||||
|| ||
|
||||
`
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class EmbedCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'embed',
|
||||
group: 'text-edit',
|
||||
memberName: 'embed',
|
||||
description: 'Sends a message in an embed.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to embed?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(text);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class MockingCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'mocking',
|
||||
aliases: ['mock'],
|
||||
group: 'text-edit',
|
||||
memberName: 'mocking',
|
||||
description: 'SenDs TexT lIkE ThiS.',
|
||||
clientPermissions: ['USE_EXTERNAL_EMOJIS'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'WHaT tEXt WoUlD yOu LiKE to COnvErt?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (text.length < 1950) return true;
|
||||
else return 'Text must be under 1950 characters.';
|
||||
},
|
||||
parse: (text) => text.toLowerCase().split('')
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase();
|
||||
return msg.say(`\u180E${text.join('')} <:sponge:318612443398144000>`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/morse');
|
||||
|
||||
module.exports = class MorseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'morse',
|
||||
group: 'text-edit',
|
||||
memberName: 'morse',
|
||||
description: 'Converts text to morse code.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (letterTrans(text, dictionary, ' ').length < 1999) return true;
|
||||
else return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = letterTrans(text.toLowerCase(), dictionary, ' ');
|
||||
return msg.say(converted);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { wordTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/pirate');
|
||||
|
||||
module.exports = class PirateCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pirate',
|
||||
group: 'text-edit',
|
||||
memberName: 'pirate',
|
||||
description: 'Converts text to pirate.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to pirate?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
else return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = wordTrans(text, dictionary);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class RepeatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'repeat',
|
||||
group: 'text-edit',
|
||||
memberName: 'repeat',
|
||||
description: 'Repeat text over and over and over and over (etc).',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to repeat over and over and over and over?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = text.repeat(2000).substr(0, 1999);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class ReverseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'reverse',
|
||||
group: 'text-edit',
|
||||
memberName: 'reverse',
|
||||
description: 'Reverses text.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to reverse?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = text.split('').reverse().join('');
|
||||
return msg.say(`\u180E${converted}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class SayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'say',
|
||||
aliases: ['copy', 'echo'],
|
||||
group: 'text-edit',
|
||||
memberName: 'say',
|
||||
description: 'Make XiaoBot say what you wish.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like XiaoBot to say?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
msg.delete();
|
||||
return msg.say(`\u180E${text}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { wordTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/temmie');
|
||||
|
||||
module.exports = class TemmieCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'temmie',
|
||||
group: 'text-edit',
|
||||
memberName: 'temmie',
|
||||
description: 'Converts text to Temmie speak.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to Temmie speak?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
else return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = wordTrans(text, dictionary);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const codes = require('../../assets/json/translate');
|
||||
const { YANDEX_KEY } = process.env;
|
||||
|
||||
module.exports = class TranslateCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'translate',
|
||||
group: 'text-edit',
|
||||
memberName: 'translate',
|
||||
description: 'Translates text to a specified language.',
|
||||
details: '**Codes:** https://tech.yandex.com/translate/doc/dg/concepts/api-overview-docpage/#languages',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to translate?',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
key: 'to',
|
||||
prompt: 'Which language is being translated to?',
|
||||
type: 'string',
|
||||
validate: (to) => {
|
||||
if (codes[to.toLowerCase()]) return true;
|
||||
else return 'Invalid Language Code. Use `help translate` for a list of codes.';
|
||||
},
|
||||
parse: (to) => to.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'from',
|
||||
prompt: 'Which language is being translated from?',
|
||||
type: 'string',
|
||||
default: '',
|
||||
validate: (from) => {
|
||||
if (codes[from.toLowerCase()]) return true;
|
||||
else return 'Invalid Language Code. Use `help translate` for a list of codes.';
|
||||
},
|
||||
parse: (from) => from.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { text, to, from } = args;
|
||||
const { body } = await snekfetch
|
||||
.get('https://translate.yandex.net/api/v1.5/tr.json/translate')
|
||||
.query({
|
||||
key: YANDEX_KEY,
|
||||
text,
|
||||
lang: from ? `${from}-${to}` : to
|
||||
});
|
||||
const lang = body.lang.split('-');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.addField(`❯ From: ${codes[lang[0]]}`,
|
||||
text)
|
||||
.addField(`❯ To: ${codes[lang[1]]}`,
|
||||
body.text[0]);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/upside-down');
|
||||
|
||||
module.exports = class UpsideDownCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'upside-down',
|
||||
aliases: ['udown'],
|
||||
group: 'text-edit',
|
||||
memberName: 'upside-down',
|
||||
description: 'Flips text upside-down.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to flip upside-down?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = letterTrans(text, dictionary);
|
||||
return msg.say(converted);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { WEBHOOK_URL } = process.env;
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'webhook',
|
||||
aliases: ['rin', 'rin-say'],
|
||||
group: 'text-edit',
|
||||
memberName: 'webhook',
|
||||
description: 'Posts a message to the webhook defined in your `process.env`.',
|
||||
guildOnly: true,
|
||||
ownerOnly: true,
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'content',
|
||||
prompt: 'What text would you like the webhook to say?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
const { content } = args;
|
||||
msg.delete();
|
||||
await snekfetch
|
||||
.post(WEBHOOK_URL)
|
||||
.send({ content });
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const zalgo = require('zalgolize');
|
||||
|
||||
module.exports = class ZalgoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'zalgo',
|
||||
group: 'text-edit',
|
||||
memberName: 'zalgo',
|
||||
description: 'Converts text to Zalgo.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to zalgo?',
|
||||
type: 'string',
|
||||
validate: (text) => {
|
||||
if (text.length < 500) return true;
|
||||
else return 'Text must be under 500 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = zalgo(text);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user