Better Validators and More Destucturing

This commit is contained in:
Daniel Odendahl Jr
2017-04-19 18:55:26 +00:00
parent c064401b37
commit d77f71b66a
40 changed files with 114 additions and 124 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ module.exports = class MemeCommand extends Command {
if (memecodes.includes(type.toLowerCase())) {
return true;
}
return 'Please enter a valid meme type. Use `;help meme` to view a list of types.';
return `${type.toLowerCase()} is not a valid meme type. Use \`;help meme\` to view a list of types.`;
},
parse: text => {
return text.toLowerCase();
@@ -34,7 +34,7 @@ module.exports = class MemeCommand extends Command {
if (toprow.match(/^[a-zA-Z0-9.,!?'\s]+$/) && toprow.length < 101) {
return true;
}
return 'Please do not use special characters and keep the rows under 100 characters each.';
return `Please do not use special characters and keep the rows under 100 characters each, you have ${toprow.length}.`;
},
parse: text => {
return text.replace(/[ ]/g, '-').replace(/[?]/g, '~q');
@@ -47,7 +47,7 @@ module.exports = class MemeCommand extends Command {
if (bottomrow.match(/^[a-zA-Z0-9.,!?'\s]+$/) && bottomrow.length < 101) {
return true;
}
return 'Please do not use special characters and keep the rows under 100 characters each.';
return `Please do not use special characters and keep the rows under 100 characters each, you have ${bottomrow.length}.`;
},
parse: text => {
return text.replace(/[ ]/g, '-').replace(/[?]/g, '~q');