Nicer args parse

This commit is contained in:
Daniel Odendahl Jr
2017-04-23 23:27:03 +00:00
parent 678d3d3ae8
commit 11a610ab5e
28 changed files with 37 additions and 95 deletions
+3 -5
View File
@@ -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, ' ')
}]
});
}