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
+1 -3
View File
@@ -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)
}]
});
}
+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, ' ')
}]
});
}
+3 -5
View File
@@ -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)
}]
});
}
+1 -3
View File
@@ -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('')
}]
});
}
+3 -5
View File
@@ -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)
}]
});
}
+2 -4
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('./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)
}]
});
}
+1 -3
View File
@@ -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)
}]
});
}