mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Shuffle and Nobody Name Commands
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { shuffle } = require('../../structures/Util');
|
||||||
|
|
||||||
|
module.exports = class OrganizationXIIINameCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'organization-xiii-name',
|
||||||
|
aliases: ['org-xiii-name', 'xiii-name', 'nobody-name'],
|
||||||
|
group: 'text-edit',
|
||||||
|
memberName: 'organization-xiii-name',
|
||||||
|
description: 'Converts a name into the Organization XIII style.',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'text',
|
||||||
|
prompt: 'What name would you like to convert?',
|
||||||
|
type: 'string',
|
||||||
|
parse: text => text.toLowerCase().split('')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg, args) {
|
||||||
|
const { text } = args;
|
||||||
|
text.push('x');
|
||||||
|
const converted = shuffle(text).join('');
|
||||||
|
return msg.say(`\u180E${converted}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { shuffle } = require('../../structrues/Util');
|
||||||
|
|
||||||
|
module.exports = class ShuffleCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'shuffle',
|
||||||
|
group: 'text-edit',
|
||||||
|
memberName: 'shuffle',
|
||||||
|
description: 'Shuffles text.',
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'text',
|
||||||
|
prompt: 'What text would you like to shuffle?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg, args) {
|
||||||
|
const { text } = args;
|
||||||
|
const converted = shuffle(text.split('')).join('');
|
||||||
|
return msg.say(`\u180E${converted}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "30.2.1",
|
"version": "30.3.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"node-opus": "^0.2.6",
|
"node-opus": "^0.2.6",
|
||||||
"snekfetch": "^3.2.9",
|
"snekfetch": "^3.2.9",
|
||||||
"uws": "^8.14.1",
|
"uws": "^8.14.1",
|
||||||
"xml2js": "^0.4.17",
|
"xml2js": "^0.4.18",
|
||||||
"zalgolize": "^1.2.4"
|
"zalgolize": "^1.2.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -61,6 +61,16 @@ class Util {
|
|||||||
static wait(time) {
|
static wait(time) {
|
||||||
return promisify(setTimeout)(time);
|
return promisify(setTimeout)(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static shuffle(arr) {
|
||||||
|
for (let i = arr.length - 1; i > 0; i--) {
|
||||||
|
const j = Math.floor(Math.random() * (i + 1));
|
||||||
|
const temp = arr[i];
|
||||||
|
arr[i] = arr[j];
|
||||||
|
arr[j] = temp;
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Util;
|
module.exports = Util;
|
||||||
|
|||||||
Reference in New Issue
Block a user