Pig Latin Command

This commit is contained in:
Daniel Odendahl Jr
2018-03-18 12:57:44 +00:00
parent 3e687a4546
commit a7fa3a744b
3 changed files with 37 additions and 1 deletions
+1
View File
@@ -276,6 +276,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
* **morse**: Converts text to morse code.
* **organization-xiii-name**: Converts a name into the Organization XIII style.
* **owo**: OwO.
* **pig-latin**: Converts text to pig latin.
* **pirate**: Converts text to pirate.
* **qr-code**: Converts text to a QR Code.
* **repeat**: Repeat text over and over and over and over (etc).
+35
View File
@@ -0,0 +1,35 @@
const { Command } = require('discord.js-commando');
module.exports = class PigLatinCommand extends Command {
constructor(client) {
super(client, {
name: 'pig-latin',
group: 'text-edit',
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`;
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "69.0.1",
"version": "69.1.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {