registerCommand(label, generator, options = {}) {
        if(label.includes(" ")) {
            throw new Error("Command label may not have spaces");
        }
        let lowercaseCommand = label.toLowerCase();
        if(this.commands[label] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
            throw new Error("You have already registered a command for " + label);
        }
        // Aliases are not deleted when deleting commands
        let command = this.commandAliases[label]; // Just to make the following if statement less messy
        lowercaseCommand = this.commandAliases[label.toLowerCase()];
        if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
            throw new Error(`Alias ${label} already registered`);
        }
        options.defaultSubcommandOptions = options.defaultSubcommandOptions || {};
        for(const key in this.commandOptions.defaultCommandOptions) {
            if(this.commandOptions.defaultCommandOptions.hasOwnProperty(key) && options[key] === undefined) {
                options[key] = this.commandOptions.defaultCommandOptions[key];
                options.defaultSubcommandOptions[key] = this.commandOptions.defaultCommandOptions[key];
            }
        }
        label = options.caseInsensitive === true ? label.toLowerCase() : label;
        if(this.commands[label]) {
            throw new Error("You have already registered a command for " + label);
        }
        command = this.commandAliases[label];
        if(this.commands[command]) {
            throw new Error(`Alias ${command} already registered`);
        }
        if(options.aliases) {
            options.aliases.forEach((alias) => {
                lowercaseCommand = alias.toLowerCase();
                if(this.commands[alias] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
                    throw new Error("You have already registered a command for alias " + alias);
                }
                command = this.commandAliases[alias];
                lowercaseCommand = this.commandAliases[alias.toLowerCase()];
                if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
                    throw new Error(`Alias ${alias} already registered`);
                }
                alias = options.caseInsensitive === true ? alias.toLowerCase() : alias;
                if(this.commands[alias]) {
                    throw new Error("You have already registered a command for alias " + alias);
                }
                command = this.commandAliases[alias];
                if(this.commands[command]) {
                    throw new Error(`Alias ${alias} already registered`);
                }
                this.commandAliases[alias] = label;
            });
        }
        this.commands[label] = new Command(label, generator, options);
        return this.commands[label];
    }
/**
    * Register a command
    * @arg {String} label The command label
    * @arg {Function | String | Array<Function | String>} generator A response string, array of functions or strings, or function that generates a string or array of strings when called.
    * If a function is passed, the function will be passed a Message object and an array of command arguments. The Message object will have an additional property `prefix`, which is the prefix used in the command.
    * `generator(msg, args)`
    * @arg {Object} [options] Command options
    * @arg {Array<String>} [options.aliases] An array of command aliases
    * @arg {Boolean} [options.argsRequired=false] If arguments are required or not
    * @arg {Boolean} [options.caseInsensitive=false] Whether the command label (and aliases) is case insensitive or not
    * @arg {Number} [options.cooldown] The cooldown between command usage in milliseconds
    * @arg {Object} [options.cooldownExclusions={}] A set of factors that limit where cooldowns are active
    * @arg {Array<String>} [options.cooldownExclusions.userIDs] An array of user IDs representing users that are not affected by cooldowns.
    * @arg {Array<String>} [options.cooldownExclusions.guildIDs] An array of guild IDs representing guilds that are not affected by cooldowns.
    * @arg {Array<String>} [options.cooldownExclusions.channelIDs] An array of channel IDs representing channels that are not affected by cooldowns.
    * @arg {Function | String} [options.cooldownMessage] A string or a function that returns a string to show when the command is on cooldown
    * @arg {Number} [option.cooldownReturns=0] Number of times to return a message when the command is used during it's cooldown.  Once the cooldown expires this is reset.  Set this to 0 to always return a message.
    * @arg {Object} [options.defaultSubcommandOptions={}] Default subcommand options. This object takes the same options as a normal Command
    * @arg {Boolean} [options.deleteCommand=false] Whether to delete the user command message or not
    * @arg {String} [options.description="No description"] A short description of the command to show in the default help command
    * @arg {Boolean} [options.dmOnly=false] Whether to prevent the command from being used in guilds or not
    * @arg {Function | String} [options.errorMessage] A string or a function that returns a string to show if the execution of the command handler somehow fails.
    * @arg {String} [options.fullDescription="No full description"] A detailed description of the command to show in the default help command
    * @arg {Boolean} [options.guildOnly=false] Whether to prevent the command from being used in Direct Messages or not
    * @arg {Boolean} [options.hidden=false] Whether or not the command should be hidden from the default help command list
    * @arg {Object} [options.hooks] A set of functions to be executed at different times throughout the command's processing
    * @arg {Function} [options.hooks.preCommand] A function that is executed before any permission or cooldown checks is made. The function is passed the command message and arguments as parameters.
    * @arg {Function} [options.hooks.postCheck] A function that is executed after all checks have cleared, but before the command is executed. The function is passed the command message, arguments, and if command checks were passed as parameters.
    * @arg {Function} [options.hooks.postExecution] A function that is executed after the command is executed, regardless of the final failed state of the command. The function is passed the command message, arguments, and if execution succeeded as parameters.
    * @arg {Function} [options.hooks.postCommand] A function that is executed after a response has been posted, and the command has finished processing. The function is passed the command message, arguments, and the response message (if applicable) as parameters.
    * @arg {Function | String} [options.invalidUsageMessage] A string or a function that returns a string to show when a command was improperly used
    * @arg {Function | String} [options.permissionMessage] A string or a function that returns a string to show when the user doesn't have permissions to use the command
    * @arg {Array<{emoji: String, type: String, response: Function | String | Array<Function | String>}>} [options.reactionButtons] An array of objects specifying reaction buttons
    * `emoji` specifies the button emoji. Custom emojis should be in format `emojiName:emojiID`
    * `type` specifies the type of the reaction button, either "edit" or "cancel"
    * `response` specifies the content to edit the message to when the reaction button is pressed. This accepts the same arguments as the `generator` parameter of this function, but with an extra userID parameter for generator functions (`function(msg, args, userID)`) describing the user that made the reaction
    * @arg {Number} [options.reactionButtonTimeout=60000] Time (in milliseconds) to wait before invalidating the command's reaction buttons
    * @arg {Object} [options.requirements] A set of factors that limit who can call the command
    * @arg {Function | Array<String>} [options.requirements.userIDs] An array or a function that returns an array of user IDs representing users that can call the command
    * @arg {Function | Object} [options.requirements.permissions] An object or a function that returns an object containing permission keys the user must match to use the command
    * i.e.:
    * ```
    * {
    *   "administrator": false,
    *   "manageMessages": true
    * }
    * ```
    * In the above example, the user must not have administrator permissions, but must have manageMessages to use the command
    * @arg {Function | Array<String>} [options.requirements.roleIDs] An array or a function that returns an array of role IDs that would allow a user to use the command
    * @arg {Function | Array<String>} [options.requirements.roleNames] An array or a function that returns an array of role names that would allow a user to use the command
    * @arg {Function} [options.requirements.custom] A function that accepts a message and returns true if the command should be run
    * @arg {Boolean} [option.restartCooldown=false] Whether or not to restart a command's cooldown every time it's used.
    * @arg {String} [options.usage] Details on how to call the command to show in the default help command
    * @returns {Command}
    */
Register a command
@arg {String} label The command label
@arg {Function | String | Array} generator A response string, array of functions or strings, or function that generates a string or array of strings when called.
If a function is passed, the function will be passed a Message object and an array of command arguments. The Message object will have an additional property `prefix`, which is the prefix used in the command.
Register a command @arg { String } label The command label @arg { Function | String | Array } generator A response string array of functions or strings or function that generates a string or array of strings when called . If a function is passed the function will be passed a Message object and an array of command arguments . The Message object will have an additional property ` prefix ` which is the prefix used in the command .
registerCommand(label, generator, options = {}) {
        if(label.includes(" ")) {
            throw new Error("Command label may not have spaces");
        }
        let lowercaseCommand = label.toLowerCase();
        if(this.commands[label] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
            throw new Error("You have already registered a command for " + label);
        }
        let command = this.commandAliases[label]; 
        lowercaseCommand = this.commandAliases[label.toLowerCase()];
        if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
            throw new Error(`Alias ${label} already registered`);
        }
        options.defaultSubcommandOptions = options.defaultSubcommandOptions || {};
        for(const key in this.commandOptions.defaultCommandOptions) {
            if(this.commandOptions.defaultCommandOptions.hasOwnProperty(key) && options[key] === undefined) {
                options[key] = this.commandOptions.defaultCommandOptions[key];
                options.defaultSubcommandOptions[key] = this.commandOptions.defaultCommandOptions[key];
            }
        }
        label = options.caseInsensitive === true ? label.toLowerCase() : label;
        if(this.commands[label]) {
            throw new Error("You have already registered a command for " + label);
        }
        command = this.commandAliases[label];
        if(this.commands[command]) {
            throw new Error(`Alias ${command} already registered`);
        }
        if(options.aliases) {
            options.aliases.forEach((alias) => {
                lowercaseCommand = alias.toLowerCase();
                if(this.commands[alias] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
                    throw new Error("You have already registered a command for alias " + alias);
                }
                command = this.commandAliases[alias];
                lowercaseCommand = this.commandAliases[alias.toLowerCase()];
                if(this.commands[command] || (this.commands[lowercaseCommand] && this.commands[lowercaseCommand].caseInsensitive)) {
                    throw new Error(`Alias ${alias} already registered`);
                }
                alias = options.caseInsensitive === true ? alias.toLowerCase() : alias;
                if(this.commands[alias]) {
                    throw new Error("You have already registered a command for alias " + alias);
                }
                command = this.commandAliases[alias];
                if(this.commands[command]) {
                    throw new Error(`Alias ${alias} already registered`);
                }
                this.commandAliases[alias] = label;
            });
        }
        this.commands[label] = new Command(label, generator, options);
        return this.commands[label];
    }
registerCommand ( label , generator , options = { } ) { if ( label . includes ( " " ) ) { throw new Error ( "Command label may not have spaces" ) ; } let lowercaseCommand = label . toLowerCase ( ) ; if ( this . commands [ label ] || ( this . commands [ lowercaseCommand ] && this . commands [ lowercaseCommand ] . caseInsensitive ) ) { throw new Error ( "You have already registered a command for " + label ) ; } let command = this . commandAliases [ label ] ; lowercaseCommand = this . commandAliases [ label . toLowerCase ( ) ] ; if ( this . commands [ command ] || ( this . commands [ lowercaseCommand ] && this . commands [ lowercaseCommand ] . caseInsensitive ) ) { throw new Error ( ` ${ label } ` ) ; } options . defaultSubcommandOptions = options . defaultSubcommandOptions || { } ; for ( const key in this . commandOptions . defaultCommandOptions ) { if ( this . commandOptions . defaultCommandOptions . hasOwnProperty ( key ) && options [ key ] === undefined ) { options [ key ] = this . commandOptions . defaultCommandOptions [ key ] ; options . defaultSubcommandOptions [ key ] = this . commandOptions . defaultCommandOptions [ key ] ; } } label = options . caseInsensitive === true ? label . toLowerCase ( ) : label ; if ( this . commands [ label ] ) { throw new Error ( "You have already registered a command for " + label ) ; } command = this . commandAliases [ label ] ; if ( this . commands [ command ] ) { throw new Error ( ` ${ command } ` ) ; } if ( options . aliases ) { options . aliases . forEach ( ( alias ) => { lowercaseCommand = alias . toLowerCase ( ) ; if ( this . commands [ alias ] || ( this . commands [ lowercaseCommand ] && this . commands [ lowercaseCommand ] . caseInsensitive ) ) { throw new Error ( "You have already registered a command for alias " + alias ) ; } command = this . commandAliases [ alias ] ; lowercaseCommand = this . commandAliases [ alias . toLowerCase ( ) ] ; if ( this . commands [ command ] || ( this . commands [ lowercaseCommand ] && this . commands [ lowercaseCommand ] . caseInsensitive ) ) { throw new Error ( ` ${ alias } ` ) ; } alias = options . caseInsensitive === true ? alias . toLowerCase ( ) : alias ; if ( this . commands [ alias ] ) { throw new Error ( "You have already registered a command for alias " + alias ) ; } command = this . commandAliases [ alias ] ; if ( this . commands [ command ] ) { throw new Error ( ` ${ alias } ` ) ; } this . commandAliases [ alias ] = label ; } ) ; } this . commands [ label ] = new Command ( label , generator , options ) ; return this . commands [ label ] ; }
Register a command
 @arg {String} label The command label
 @arg {Function | String | Array<Function | String>} generator A response string, array of functions or strings, or function that generates a string or array of strings when called.
Register a command @arg { String } label The command label @arg { Function | String | Array<Function | String > } generator A response string array of functions or strings or function that generates a string or array of strings when called .
// Aliases are not deleted when deleting commands // Just to make the following if statement less messy