feat: If a required argument is not supplied, ask for it and then resolve the command listener.
Thanks to @amovah for his contributions
This commit is contained in:
@ -6,6 +6,7 @@ const ESCAPABLE = '.^$*+?()[{\\|}]'.split('');
|
||||
|
||||
const REQUIRED = 0;
|
||||
const OPTIONAL = 1;
|
||||
const REST = 2;
|
||||
|
||||
/**
|
||||
* Parses a message for arguments, based on format
|
||||
@ -39,8 +40,7 @@ export default function argumentParser(format, string) {
|
||||
string = string.replace(/[^\s]+/, '').trim();
|
||||
format = format.replace(/[^\s]+/, '').trim();
|
||||
|
||||
if (!format)
|
||||
return {args: {}, params: {}};
|
||||
if (!format) return {args: {}, params: {}};
|
||||
|
||||
let indexes = [],
|
||||
params = {};
|
||||
@ -60,6 +60,7 @@ export default function argumentParser(format, string) {
|
||||
});
|
||||
format = format.replace(FORMAT_REST, (full, arg, offset) => {
|
||||
indexes.push({offset, arg});
|
||||
params[arg] = REST;
|
||||
return getFormat(null, 'rest');
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user