mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 21:40:51 +02:00
Pig Latin Command
This commit is contained in:
@@ -276,6 +276,7 @@ served over 10,000 servers with a uniquely devoted fanbase.
|
|||||||
* **morse**: Converts text to morse code.
|
* **morse**: Converts text to morse code.
|
||||||
* **organization-xiii-name**: Converts a name into the Organization XIII style.
|
* **organization-xiii-name**: Converts a name into the Organization XIII style.
|
||||||
* **owo**: OwO.
|
* **owo**: OwO.
|
||||||
|
* **pig-latin**: Converts text to pig latin.
|
||||||
* **pirate**: Converts text to pirate.
|
* **pirate**: Converts text to pirate.
|
||||||
* **qr-code**: Converts text to a QR Code.
|
* **qr-code**: Converts text to a QR Code.
|
||||||
* **repeat**: Repeat text over and over and over and over (etc).
|
* **repeat**: Repeat text over and over and over and over (etc).
|
||||||
|
|||||||
@@ -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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "69.0.1",
|
"version": "69.1.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user