Skip to content

--help command throws error when a registered command is set to "caseSensitive: false" #17

Description

@TrentWest7190

issue in question is caused by the following block of code

App.js, line 213

// Find whether or not the requested command exists
var cmd = null;
var userInputCommand = argv._[0];
for (var name in this.commands) {
	var command = this.commands[name];
	var validCommandName = command.caseSensitive ? name : name.toLowerCase();
	var validUserInput = command.caseSensitive ? userInputCommand : userInputCommand.toLowerCase();
	if (validCommandName === validUserInput) {
		cmd = command;
		break;
	}	
}

When doing something like "!prefix --help" while a registered command has caseSensitive set to false, userInputCommand is undefined, as argv._ has nothing inside of it. When the loop reaches the command where the caseSensitive flag is set, it tries to do .toLowerCase() on an undefined value, causing the error.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions