mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
More uniform group names
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { list, base64 } = require('../../util/Util');
|
||||
const modes = ['encode', 'decode'];
|
||||
|
||||
module.exports = class Base64Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'base64',
|
||||
group: 'edit-text',
|
||||
memberName: 'base64',
|
||||
description: 'Converts text to/from Base64.',
|
||||
details: `**Modes:** ${modes.join(', ')}`,
|
||||
args: [
|
||||
{
|
||||
key: 'mode',
|
||||
prompt: `Would you like to ${list(modes, 'or')}?`,
|
||||
type: 'string',
|
||||
oneOf: modes,
|
||||
parse: mode => mode.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to Base64?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (base64(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { mode, text }) {
|
||||
const converted = base64(text, mode);
|
||||
if (!converted) return msg.reply('That is not valid Base64.');
|
||||
return msg.say(converted);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class BinaryCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'binary',
|
||||
group: 'edit-text',
|
||||
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;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(this.binary(text));
|
||||
}
|
||||
|
||||
binary(text) {
|
||||
return text.split('').map(str => {
|
||||
const converted = str.charCodeAt(0).toString(2);
|
||||
return converted.padStart(8, '0');
|
||||
}).join(' ');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/braille');
|
||||
|
||||
module.exports = class BrailleCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'braille',
|
||||
group: 'edit-text',
|
||||
memberName: 'braille',
|
||||
description: 'Converts text to braille.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to braille?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { wordTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/brony-speak');
|
||||
|
||||
module.exports = class BronySpeakCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'brony-speak',
|
||||
aliases: ['pony-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'brony-speak',
|
||||
description: 'Converts text to brony speak.',
|
||||
credit: [
|
||||
{
|
||||
name: 'Hasbro',
|
||||
url: 'https://shop.hasbro.com/en-us',
|
||||
reason: 'Original "My Little Pony: Friendship is Magic" Show',
|
||||
reasonURL: 'https://mylittlepony.hasbro.com/en-us'
|
||||
},
|
||||
{
|
||||
name: 'Shrick',
|
||||
url: 'https://www.deviantart.com/shrick',
|
||||
reason: 'English-to-Brony Dictionary Data',
|
||||
reasonURL: 'https://www.deviantart.com/shrick/art/Brony-dictionary-version-2-207157029'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to brony speak?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (wordTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(wordTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class ClapCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'clap',
|
||||
aliases: ['clapping'],
|
||||
group: 'edit-text',
|
||||
memberName: 'clap',
|
||||
description: 'Sends 👏 text 👏 like 👏 this.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What 👏 text 👏 would 👏 you 👏 like 👏 to 👏 convert?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (text.replace(/ /g, ' 👏 ').length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(text.replace(/ /g, ' 👏 '));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class CowSayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cow-say',
|
||||
group: 'edit-text',
|
||||
memberName: 'cow-say',
|
||||
description: 'Makes a cow say your text.',
|
||||
credit: [
|
||||
{
|
||||
name: 'cowsay Online',
|
||||
url: 'http://cowsay.morecode.org/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like the cow to say?',
|
||||
type: 'string',
|
||||
max: 1000
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://cowsay.morecode.org/say')
|
||||
.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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/cursive');
|
||||
|
||||
module.exports = class CursiveCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cursive',
|
||||
group: 'edit-text',
|
||||
memberName: 'cursive',
|
||||
description: 'Converts text to cursive.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to cursive?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/dvorak');
|
||||
|
||||
module.exports = class DvorakCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dvorak',
|
||||
group: 'edit-text',
|
||||
memberName: 'dvorak',
|
||||
description: 'Converts text to Dvorak encoding.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to Dvorak encoding?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = class EmbedCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'embed',
|
||||
group: 'edit-text',
|
||||
memberName: 'embed',
|
||||
description: 'Sends text in an embed.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to embed?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.embed(new MessageEmbed().setDescription(text));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/emojify');
|
||||
|
||||
module.exports = class EmojifyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'emojify',
|
||||
aliases: ['regional-indicator'],
|
||||
group: 'edit-text',
|
||||
memberName: 'emojify',
|
||||
description: 'Converts text to emoji form.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to emoji?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text.toLowerCase(), dictionary, ' ').length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
},
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary, ' '));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/fancy');
|
||||
|
||||
module.exports = class FancyCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fancy',
|
||||
group: 'edit-text',
|
||||
memberName: 'fancy',
|
||||
description: 'Converts text to fancy letters.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to fancy letters?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class HexCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'hex',
|
||||
aliases: ['hexidecimal'],
|
||||
group: 'edit-text',
|
||||
memberName: 'hex',
|
||||
description: 'Converts text to hex.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to hex?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (Buffer.from(text).toString('hex').length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(Buffer.from(text).toString('hex'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class LatlmesCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'latlmes',
|
||||
group: 'edit-text',
|
||||
memberName: 'latlmes',
|
||||
description: 'Creates a Latlmes fake link that redirects to a rickroll.',
|
||||
credit: [
|
||||
{
|
||||
name: 'Latlmes',
|
||||
url: 'https://www.latlmes.com/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'section',
|
||||
prompt: 'What section of the news should the link display?',
|
||||
type: 'string',
|
||||
max: 100,
|
||||
parse: query => encodeURIComponent(query.replace(/ /g, '-').toLowerCase())
|
||||
},
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like the link to display as?',
|
||||
type: 'string',
|
||||
max: 500,
|
||||
parse: query => encodeURIComponent(query.replace(/ /g, '-').toLowerCase())
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { section, query }) {
|
||||
return msg.say(`http://www.latlmes.com/${section}/${query}-1`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class LMGTFYCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'lmgtfy',
|
||||
aliases: ['let-me-google-that-for-you'],
|
||||
group: 'edit-text',
|
||||
memberName: 'lmgtfy',
|
||||
description: 'Creates a LMGTFY link with the query you provide.',
|
||||
credit: [
|
||||
{
|
||||
name: 'LMGTFY',
|
||||
url: 'https://lmgtfy.com/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
prompt: 'What would you like the link to search for?',
|
||||
type: 'string',
|
||||
validate: query => {
|
||||
if (encodeURIComponent(query).length < 1950) return true;
|
||||
return 'Invalid query, your query is too long.';
|
||||
},
|
||||
parse: query => encodeURIComponent(query)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { query }) {
|
||||
return msg.say(`http://lmgtfy.com/?iie=1&q=${query}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class LowercaseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'lowercase',
|
||||
aliases: ['to-lowercase'],
|
||||
group: 'edit-text',
|
||||
memberName: 'lowercase',
|
||||
description: 'Converts text to lowercase.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to lowercase?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(text.toLowerCase());
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { hash } = require('../../util/Util');
|
||||
|
||||
module.exports = class MD5Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'md5',
|
||||
group: 'edit-text',
|
||||
memberName: 'md5',
|
||||
description: 'Creates a hash of text with the MD5 algorithm.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to create an MD5 hash of?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(hash(text, 'md5'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MOCKING_EMOJI_ID, MOCKING_EMOJI_NAME } = process.env;
|
||||
|
||||
module.exports = class MockingCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'mocking',
|
||||
aliases: ['mock'],
|
||||
group: 'edit-text',
|
||||
memberName: 'mocking',
|
||||
description: 'SenDs TexT lIkE ThiS.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'WHaT tEXt WoUlD yOu LiKE to COnvErt?',
|
||||
type: 'string',
|
||||
max: 1950,
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
const canEmoji = msg.channel.type === 'text'
|
||||
? msg.channel.permissionsFor(this.client.user).has('USE_EXTERNAL_EMOJIS')
|
||||
: true;
|
||||
const letters = text.split('');
|
||||
for (let i = 0; i < letters.length; i += Math.floor(Math.random() * 4)) {
|
||||
letters[i] = letters[i].toUpperCase();
|
||||
}
|
||||
return msg.say(`${letters.join('')}${canEmoji ? this.mockingEmoji : ''}`);
|
||||
}
|
||||
|
||||
get mockingEmoji() {
|
||||
return MOCKING_EMOJI_ID && MOCKING_EMOJI_NAME ? ` <:${MOCKING_EMOJI_NAME}:${MOCKING_EMOJI_ID}>` : '';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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',
|
||||
aliases: ['morse-code'],
|
||||
group: 'edit-text',
|
||||
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.toLowerCase(), dictionary, ' ').length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
},
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary, ' '));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { shuffle, firstUpperCase } = require('../../util/Util');
|
||||
|
||||
module.exports = class NobodyNameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'nobody-name',
|
||||
aliases: ['organization-name', 'org-name', 'organization-xiii-name'],
|
||||
group: 'edit-text',
|
||||
memberName: 'nobody-name',
|
||||
description: 'Converts a name into the Organization XIII style.',
|
||||
credit: [
|
||||
{
|
||||
name: 'Square Enix',
|
||||
url: 'https://square-enix-games.com/',
|
||||
reason: 'Original "Kingdom Hearts" Game',
|
||||
reasonURL: 'https://www.kingdomhearts.com/home/us/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What name would you like to convert?',
|
||||
type: 'string',
|
||||
max: 1950,
|
||||
parse: text => text.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
const letters = text.split('');
|
||||
letters.push('x');
|
||||
const shuffled = shuffle(letters);
|
||||
return msg.say(firstUpperCase(shuffled.join('')));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const faces = ['(・`ω´・)', ';;w;;', 'owo', 'UwU', '>w<', '^w^'];
|
||||
|
||||
module.exports = class OwOCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'owo',
|
||||
aliases: ['furry-speak', 'fur-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'owo',
|
||||
description: 'OwO.',
|
||||
credit: [
|
||||
{
|
||||
name: 'devsnek',
|
||||
url: 'https://github.com/devsnek',
|
||||
reason: 'Code'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to OwO?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (this.owo(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(this.owo(text));
|
||||
}
|
||||
|
||||
owo(text) {
|
||||
return text
|
||||
.replace(/(?:r|l)/g, 'w')
|
||||
.replace(/(?:R|L)/g, 'W')
|
||||
.replace(/n([aeiou])/g, 'ny$1')
|
||||
.replace(/N([aeiou])/g, 'Ny$1')
|
||||
.replace(/N([AEIOU])/g, 'NY$1')
|
||||
.replace(/ove/g, 'uv')
|
||||
.replace(/!+/g, ` ${faces[Math.floor(Math.random() * faces.length)]} `)
|
||||
.trim();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class PigLatinCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pig-latin',
|
||||
group: 'edit-text',
|
||||
memberName: 'pig-latin',
|
||||
description: 'Converts text to pig latin.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to pig latin?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (this.pigLatin(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(this.pigLatin(text));
|
||||
}
|
||||
|
||||
pigLatin(text) {
|
||||
return text.replace(/\w+/g, this.pigLatinWord).toLowerCase();
|
||||
}
|
||||
|
||||
pigLatinWord(word) {
|
||||
return `${word.slice(1)}${word.charAt(0)}ay`;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
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',
|
||||
aliases: ['pirate-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'pirate',
|
||||
description: 'Converts text to pirate.',
|
||||
credit: [
|
||||
{
|
||||
name: 'mikewesthad',
|
||||
url: 'https://github.com/mikewesthad',
|
||||
reason: 'English-to-Pirate Dictionary Data',
|
||||
reasonURL: 'https://github.com/mikewesthad/pirate-speak/blob/master/lib/pirate-speak.js#L1-L155'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to pirate?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (wordTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(wordTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class RepeatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'repeat',
|
||||
group: 'edit-text',
|
||||
memberName: 'repeat',
|
||||
description: 'Repeat text over and over and over and over (etc).',
|
||||
args: [
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'How many times do you want to repeat your text?',
|
||||
type: 'integer',
|
||||
min: 1,
|
||||
max: 2000
|
||||
},
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to repeat over and over and over and over?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (!text.includes('@everyone') && !text.includes('@here')) return true;
|
||||
return 'Invalid text, please do not repeat everyone or here mentions.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { amount, text }) {
|
||||
return msg.say(text.repeat(amount).substr(0, 2000));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class ReverseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'reverse',
|
||||
group: 'edit-text',
|
||||
memberName: 'reverse',
|
||||
description: 'Reverses text.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to reverse?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(text.split('').reverse().join(''));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class SayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'say',
|
||||
aliases: ['copy', 'echo'],
|
||||
group: 'edit-text',
|
||||
memberName: 'say',
|
||||
description: 'Make me say what you want, master.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like me to say?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
try {
|
||||
if (msg.channel.type === 'text' && msg.deletable) await msg.delete();
|
||||
return msg.say(text);
|
||||
} catch {
|
||||
return msg.say(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { hash } = require('../../util/Util');
|
||||
|
||||
module.exports = class SHA1Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'sha-1',
|
||||
group: 'edit-text',
|
||||
memberName: 'sha-1',
|
||||
description: 'Creates a hash of text with the SHA-1 algorithm.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to create an SHA-1 hash of?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(hash(text, 'sha1'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { hash } = require('../../util/Util');
|
||||
|
||||
module.exports = class SHA256Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'sha-256',
|
||||
group: 'edit-text',
|
||||
memberName: 'sha-256',
|
||||
description: 'Creates a hash of text with the SHA-256 algorithm.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to create an SHA-256 hash of?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(hash(text, 'sha256'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class ShipNameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ship-name',
|
||||
group: 'edit-text',
|
||||
memberName: 'ship-name',
|
||||
description: 'Creates a ship name from two names.',
|
||||
args: [
|
||||
{
|
||||
key: 'start',
|
||||
label: 'start name',
|
||||
prompt: 'What name should be at the start of the ship name?',
|
||||
type: 'string',
|
||||
max: 500,
|
||||
parse: start => start.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'end',
|
||||
label: 'end name',
|
||||
prompt: 'What name should be at the end of the ship name?',
|
||||
type: 'string',
|
||||
max: 500,
|
||||
parse: end => end.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { start, end }) {
|
||||
return msg.say(`${start.slice(0, Math.floor(start.length / 2))}${end.slice(Math.floor(end.length / 2))}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { shuffle } = require('../../util/Util');
|
||||
|
||||
module.exports = class ShuffleCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shuffle',
|
||||
group: 'edit-text',
|
||||
memberName: 'shuffle',
|
||||
description: 'Shuffles text.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to shuffle?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(shuffle(text.split('')).join(''));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class SnakeSpeakCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'snake-speak',
|
||||
aliases: ['snek-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'snake-speak',
|
||||
description: 'Convertsssss text to sssssnake ssssspeak.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to sssssnake ssssspeak?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (text.replace(/s/gi, 'sssss').length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(text.replace(/s/gi, 'sssss'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class SpoilerLetterCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'spoiler-letter',
|
||||
aliases: ['spoiler'],
|
||||
group: 'edit-text',
|
||||
memberName: 'spoiler-letter',
|
||||
description: 'Sends text with each and every character as an individual spoiler.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (`||${text.split('').join('||||')}||`.length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(`||${text.split('').join('||||')}||`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/superscript');
|
||||
|
||||
module.exports = class SuperscriptCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'superscript',
|
||||
aliases: ['tiny-text', 'small-text'],
|
||||
group: 'edit-text',
|
||||
memberName: 'superscript',
|
||||
description: 'Converts text to tiny text.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to tiny text?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('../../assets/json/tebahpla');
|
||||
|
||||
module.exports = class TebahplaCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'tebahpla',
|
||||
aliases: ['reverse-alphabet', 'alphabet-reverse'],
|
||||
group: 'edit-text',
|
||||
memberName: 'tebahpla',
|
||||
description: 'Reverses the alphabet of text.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to reverse the alphabet of?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
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',
|
||||
aliases: ['temmie-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'temmie',
|
||||
description: 'Converts text to Temmie speak.',
|
||||
credit: [
|
||||
{
|
||||
name: 'UNDERTALE',
|
||||
url: 'https://undertale.com/',
|
||||
reason: 'Original Game'
|
||||
},
|
||||
{
|
||||
name: 'ebearskittychan',
|
||||
url: 'https://twitter.com/ebearskittychan',
|
||||
reason: 'English-to-Temmie Dictionary Data'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to Temmie speak?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (this.temmize(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(this.temmize(text));
|
||||
}
|
||||
|
||||
temmize(text) {
|
||||
return wordTrans(text, dictionary)
|
||||
.replace(/ing/gi, 'in')
|
||||
.replace(/!/g, '!!!!111!1!')
|
||||
.replace(/'/g, '');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const translate = require('@vitalets/google-translate-api');
|
||||
const { list } = require('../../util/Util');
|
||||
const codes = translate.languages;
|
||||
|
||||
module.exports = class TranslateCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'translate',
|
||||
aliases: ['google-translate'],
|
||||
group: 'edit-text',
|
||||
memberName: 'translate',
|
||||
description: 'Translates text to a specific language.',
|
||||
details: `**Codes:** ${Object.keys(codes).join(', ')}`,
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Google',
|
||||
url: 'https://www.google.com/',
|
||||
reason: 'Google Translate',
|
||||
reasonURL: 'https://translate.google.com/'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to translate?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
},
|
||||
{
|
||||
key: 'target',
|
||||
prompt: `Which language would you like to translate to? Either ${list(Object.keys(codes), 'or')}.`,
|
||||
type: 'string',
|
||||
validate: target => {
|
||||
const value = target.toLowerCase();
|
||||
if (codes[value] || Object.keys(codes).find(key => codes[key].toLowerCase() === value)) return true;
|
||||
return `Invalid target, please enter either ${list(Object.keys(codes), 'or')}.`;
|
||||
},
|
||||
parse: target => {
|
||||
const value = target.toLowerCase();
|
||||
if (codes[value]) return value;
|
||||
return Object.keys(codes).find(key => codes[key].toLowerCase() === value);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'base',
|
||||
prompt: `Which language would you like to use as the base? Either ${list(Object.keys(codes), 'or')}.`,
|
||||
type: 'string',
|
||||
default: 'auto',
|
||||
validate: base => {
|
||||
const value = base.toLowerCase();
|
||||
if (codes[value] || Object.keys(codes).find(key => codes[key].toLowerCase() === value)) return true;
|
||||
return `Invalid base, please enter either ${list(Object.keys(codes), 'or')}.`;
|
||||
},
|
||||
parse: base => {
|
||||
const value = base.toLowerCase();
|
||||
if (codes[value]) return value;
|
||||
return Object.keys(codes).find(key => codes[key].toLowerCase() === value);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text, target, base }) {
|
||||
try {
|
||||
const { text: result, from } = await translate(text, { to: target, from: base });
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x4285F4)
|
||||
.setFooter('Powered by Google Translate', 'https://i.imgur.com/h3RoHyp.png')
|
||||
.addField(`❯ From: ${codes[from.language.iso]}`, from.text.value || text)
|
||||
.addField(`❯ To: ${codes[target]}`, result);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class UnspoilerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unspoiler',
|
||||
group: 'edit-text',
|
||||
memberName: 'unspoiler',
|
||||
description: 'Removes all spoilers from a message.',
|
||||
args: [
|
||||
{
|
||||
key: 'message',
|
||||
prompt: 'What message would you like to unspoiler?',
|
||||
type: 'message'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { message }) {
|
||||
return msg.say(message.content.replace(/\|\|([^|]+)\|\|/g, '$1'));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class UppercaseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'uppercase',
|
||||
aliases: ['to-uppercase', 'all-caps', 'caps'],
|
||||
group: 'edit-text',
|
||||
memberName: 'uppercase',
|
||||
description: 'Converts text to uppercase.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to uppercase?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(text.toUpperCase());
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
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: ['u-down'],
|
||||
group: 'edit-text',
|
||||
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, { text }) {
|
||||
return msg.say(letterTrans(text, dictionary).split('').reverse().join(''));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class URLDecodeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'url-decode',
|
||||
aliases: ['decode-url', 'decode-uri', 'uri-decode', 'decode-uri-component'],
|
||||
group: 'edit-text',
|
||||
memberName: 'url-decode',
|
||||
description: 'Decodes URL characters to regular characters.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to decode?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (decodeURIComponent(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(decodeURIComponent(text));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class URLEncodeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'url-encode',
|
||||
aliases: ['encode-url', 'encode-uri', 'uri-encode', 'encode-uri-component'],
|
||||
group: 'edit-text',
|
||||
memberName: 'url-encode',
|
||||
description: 'Encodes text to URL-friendly characters.',
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to encode?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (encodeURIComponent(text).length < 2000) return true;
|
||||
return 'Invalid text, your text is too long.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
return msg.say(encodeURIComponent(text));
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
const Command = require('../../structures/Command');
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'webhook',
|
||||
aliases: ['rin', 'rin-say'],
|
||||
group: 'edit-text',
|
||||
memberName: 'webhook',
|
||||
description: 'Posts a message to the webhook defined in the bot owner\'s `process.env`.',
|
||||
details: 'Only the bot owner(s) may use this command.',
|
||||
ownerOnly: true,
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'content',
|
||||
prompt: 'What text would you like the webhook to say?',
|
||||
type: 'string'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { content }) {
|
||||
try {
|
||||
if (msg.channel.type === 'text' && msg.deletable) await msg.delete();
|
||||
await this.client.webhook.send(content);
|
||||
return null;
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const soap = require('soap');
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'yoda',
|
||||
aliases: ['yoda-speak'],
|
||||
group: 'edit-text',
|
||||
memberName: 'yoda',
|
||||
description: 'Converts text to Yoda speak.',
|
||||
credit: [
|
||||
{
|
||||
name: 'The Yoda-Speak Generator',
|
||||
url: 'https://www.yodaspeak.co.uk/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'sentence',
|
||||
prompt: 'What sentence would you like to convert to Yoda speak?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.soapClient = null;
|
||||
}
|
||||
|
||||
async run(msg, { sentence }) {
|
||||
try {
|
||||
if (!this.soapClient) await this.setUpClient();
|
||||
const response = await this.soapClient.yodaTalkAsync({ inputText: sentence });
|
||||
const text = response[0].return;
|
||||
if (!text) return msg.reply('Empty, this message is. Try again later, you must.');
|
||||
return msg.say(text);
|
||||
} catch (err) {
|
||||
return msg.reply(`Being a jerk again, Yoda is: \`${err.message}\`. Try again later, you must.`);
|
||||
}
|
||||
}
|
||||
|
||||
async setUpClient() {
|
||||
this.soapClient = await soap.createClientAsync('http://www.yodaspeak.co.uk/webservice/yodatalk.php?wsdl');
|
||||
return this.soapClient;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const zalgo = require('../../assets/json/zalgo');
|
||||
|
||||
module.exports = class ZalgoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'zalgo',
|
||||
group: 'edit-text',
|
||||
memberName: 'zalgo',
|
||||
description: 'Converts text to zalgo.',
|
||||
credit: [
|
||||
{
|
||||
name: 'clux',
|
||||
url: 'https://github.com/clux',
|
||||
reason: 'Zalgo Character Data',
|
||||
reasonURL: 'https://github.com/clux/zalgolize/blob/master/zalgo.js#L3-L21'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to zalgo?',
|
||||
type: 'string',
|
||||
max: 200
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { text }) {
|
||||
let result = '';
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
result += text[i];
|
||||
for (const chars of Object.values(zalgo)) {
|
||||
let count = Math.floor(Math.random() * 5);
|
||||
while (count--) result += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
}
|
||||
return msg.say(result);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user