automatically reform schemas to have options with trailing args

This commit is contained in:
notgne2 2019-09-06 12:00:12 -07:00
parent 09dae249ef
commit 81deb86730

View File

@ -605,7 +605,13 @@ class ChatBot extends Daemon {
// Skip if not a real command // Skip if not a real command
if (registeredCommand.fn === null) continue; if (registeredCommand.fn === null) continue;
for (const schema of registeredCommand.schemas) { // Add auto-generated schemas with trailing args
const schemas = registeredCommand.schemas;
schemas.forEach((schema) => {
schemas.push([...schema.filter(commandArg => commandArg.name !== undefined), ...schema.filter(commandArg => commandArg.name === undefined)]);
});
for (const schema of schemas) {
// List of match args for command (remove input args/nulls) // List of match args for command (remove input args/nulls)
const commandMatchArgs = schema const commandMatchArgs = schema
.map(commandArg => this._commandMatchArgToGeneric(commandArg)); .map(commandArg => this._commandMatchArgToGeneric(commandArg));