mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 05:54:33 +02:00
Better Validators and More Destucturing
This commit is contained in:
@@ -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}.`;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -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}.`;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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.`;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -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}.`;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -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}.`;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user