mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 21:40:51 +02:00
Nicer args parse
This commit is contained in:
@@ -25,9 +25,7 @@ module.exports = class BinaryCommand extends Command {
|
||||
}
|
||||
return 'Your message content is too long.';
|
||||
},
|
||||
parse: text => {
|
||||
return stringToBinary(text);
|
||||
}
|
||||
parse: text => stringToBinary(text)
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('./morsemappings.json');
|
||||
|
||||
module.exports = class MorseCommand extends Command {
|
||||
@@ -17,14 +17,12 @@ module.exports = class MorseCommand extends Command {
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: content => {
|
||||
if (translator.letterTrans(content, dictionary, ' ').length < 1999) {
|
||||
if (letterTrans(content, dictionary, ' ').length < 1999) {
|
||||
return true;
|
||||
}
|
||||
return 'Your message content is too long.';
|
||||
},
|
||||
parse: text => {
|
||||
return translator.letterTrans(text.toLowerCase(), dictionary, ' ');
|
||||
}
|
||||
parse: text => letterTrans(text.toLowerCase(), dictionary, ' ')
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const { wordTrans } = require('custom-translate');
|
||||
const dictionary = require('./piratewords.json');
|
||||
|
||||
module.exports = class PirateCommand extends Command {
|
||||
@@ -18,14 +18,12 @@ module.exports = class PirateCommand extends Command {
|
||||
prompt: 'What text would you like to convert to pirate?',
|
||||
type: 'string',
|
||||
validate: content => {
|
||||
if (translator.wordTrans(content, dictionary).length < 1999) {
|
||||
if (wordTrans(content, dictionary).length < 1999) {
|
||||
return true;
|
||||
}
|
||||
return 'Your message content is too long.';
|
||||
},
|
||||
parse: text => {
|
||||
return translator.wordTrans(text, dictionary);
|
||||
}
|
||||
parse: text => wordTrans(text, dictionary)
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,9 +11,7 @@ module.exports = class ReverseCommand extends Command {
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to reverse?',
|
||||
type: 'string',
|
||||
parse: text => {
|
||||
return text.split('').reverse().join('');
|
||||
}
|
||||
parse: text => text.split('').reverse().join('')
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const { wordTrans } = require('custom-translate');
|
||||
const dictionary = require('./temmiewords.json');
|
||||
|
||||
module.exports = class TemmieCommand extends Command {
|
||||
@@ -14,14 +14,12 @@ module.exports = class TemmieCommand extends Command {
|
||||
prompt: 'What text would you like to convert to Temmie speak?',
|
||||
type: 'string',
|
||||
validate: content => {
|
||||
if (translator.wordTrans(content, dictionary).length < 1999) {
|
||||
if (wordTrans(content, dictionary).length < 1999) {
|
||||
return true;
|
||||
}
|
||||
return 'Your message content is too long.';
|
||||
},
|
||||
parse: text => {
|
||||
return translator.wordTrans(text, dictionary);
|
||||
}
|
||||
parse: text => wordTrans(text, dictionary)
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const { letterTrans } = require('custom-translate');
|
||||
const dictionary = require('./udmappings.json');
|
||||
|
||||
module.exports = class UpsideDownCommand extends Command {
|
||||
@@ -17,9 +17,7 @@ module.exports = class UpsideDownCommand extends Command {
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to flip upside-down?',
|
||||
type: 'string',
|
||||
parse: text => {
|
||||
return translator.letterTrans(text, dictionary);
|
||||
}
|
||||
parse: text => letterTrans(text, dictionary)
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,9 +18,7 @@ module.exports = class ZalgoCommand extends Command {
|
||||
}
|
||||
return `Please keep your text under 500 characters, you have ${content.length}.`;
|
||||
},
|
||||
parse: text => {
|
||||
return zalgo(text);
|
||||
}
|
||||
parse: text => zalgo(text)
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user