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
+2 -2
View File
@@ -22,10 +22,10 @@ module.exports = class BanCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+2 -2
View File
@@ -19,10 +19,10 @@ module.exports = class KickCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = class LockdownCommand extends Command {
if (type.toLowerCase() === 'start' || type.toLowerCase() === 'stop') {
return true;
}
return 'Please enter either start or stop.';
return 'Please enter either `start` or `stop`.';
},
parse: text => {
return text.toLowerCase();
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = class PruneCommand extends Command {
if (count < 100 && count > 0) {
return true;
}
return 'Too many or two few messages to delete. Limit 1-99.';
return `${count} is not a valid amount of messages. Limit 1-99.`;
}
}]
});
+3 -3
View File
@@ -21,17 +21,17 @@ module.exports = class UnbanCommand extends Command {
if (userID.length === 18) {
return true;
}
return 'Invalid ID. Please enter the user you wish to unban\'s ID.';
return `${userID} is not a valid ID. Please enter the user you wish to unban's ID.`;
}
}, {
key: 'reason',
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});
+2 -2
View File
@@ -19,10 +19,10 @@ module.exports = class WarnCommand extends Command {
prompt: 'What do you want to set the reason as?',
type: 'string',
validate: reason => {
if (reason.length < 141) {
if (reason.length < 140) {
return true;
}
return 'Please keep your reason under 140 characters.';
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
}
}]
});