src/Core/Validator.js
/**
     * @param {Module} module
     * @returns {Boolean} Whether the module is considered valid or not
     */
@param {Module} module
@returns {Boolean} Whether the module is considered valid or not
@param { Module } module @returns { Boolean } Whether the module is considered valid or not
static validModule(module) {
        const PERMS = module.axon.library.enums.PERMISSIONS;
        if (!(module.options instanceof CommandOptions) ) {
            module.options = new CommandOptions(module);
            debug(module.axon, DEBUG_FLAGS.BAD, `[${module.label}] - Invalid command options... using default.`);
        } else {
            debug(module.axon, DEBUG_FLAGS.GOOD, `[${module.label}] - Valid command options.`);
        }
        if (!(module.permissions instanceof CommandPermissions) ) {
            module.permissions = new CommandPermissions(module);
            debug(module.axon, DEBUG_FLAGS.BAD, `[${module.label}] - Invalid command permissions... using default.`);
        } else {
            debug(module.axon, DEBUG_FLAGS.GOOD, `[${module.label}] - Valid command permissions.`);
        }
        for (const perm of module.permissions.bot) {
            if (!this.checkValidPermissionName(PERMS, perm) ) {
                debug(module.axon, DEBUG_FLAGS.BAD, `[${module.label}] - Invalid permissions name (${perm}) in Module.permissions.bot.`);
                return false;
            }
        }
        debug(module.axon, DEBUG_FLAGS.GOOD, `[${module.label}] - Correct permissions name in Module.permissions.bot.`);
        for (const perm of module.permissions.author.needed) {
            if (!this.checkValidPermissionName(PERMS, perm) ) {
                debug(module.axon, DEBUG_FLAGS.BAD, `[${module.label}] - Invalid permissions name (${perm}) in Module.permissions.author.needed.`);
                return false;
            }
        }
        debug(module.axon, DEBUG_FLAGS.GOOD, `[${module.label}] - Correct permissions name in Module.permissions.author.needed.`);
        for (const perm of module.permissions.author.bypass) {
            if (!this.checkValidPermissionName(PERMS, perm) ) {
                debug(module.axon, DEBUG_FLAGS.BAD, `[${module.label}] - Invalid permissions name (${perm}) in Module.permissions.author.bypass.`);
                return false;
            }
        }
        debug(module.axon, DEBUG_FLAGS.GOOD, `[${module.label}] - Correct permissions name in Module.permissions.author.bypass.`);
        return true;
    }
static validModule ( module ) { const PERMS = module . axon . library . enums . PERMISSIONS ; if ( ! ( module . options instanceof CommandOptions ) ) { module . options = new CommandOptions ( module ) ; debug ( module . axon , DEBUG_FLAGS . BAD , ` ${ module . label } ` ) ; } else { debug ( module . axon , DEBUG_FLAGS . GOOD , ` ${ module . label } ` ) ; } if ( ! ( module . permissions instanceof CommandPermissions ) ) { module . permissions = new CommandPermissions ( module ) ; debug ( module . axon , DEBUG_FLAGS . BAD , ` ${ module . label } ` ) ; } else { debug ( module . axon , DEBUG_FLAGS . GOOD , ` ${ module . label } ` ) ; } for ( const perm of module . permissions . bot ) { if ( ! this . checkValidPermissionName ( PERMS , perm ) ) { debug ( module . axon , DEBUG_FLAGS . BAD , ` ${ module . label } ${ perm } ` ) ; return false ; } } debug ( module . axon , DEBUG_FLAGS . GOOD , ` ${ module . label } ` ) ; for ( const perm of module . permissions . author . needed ) { if ( ! this . checkValidPermissionName ( PERMS , perm ) ) { debug ( module . axon , DEBUG_FLAGS . BAD , ` ${ module . label } ${ perm } ` ) ; return false ; } } debug ( module . axon , DEBUG_FLAGS . GOOD , ` ${ module . label } ` ) ; for ( const perm of module . permissions . author . bypass ) { if ( ! this . checkValidPermissionName ( PERMS , perm ) ) { debug ( module . axon , DEBUG_FLAGS . BAD , ` ${ module . label } ${ perm } ` ) ; return false ; } } debug ( module . axon , DEBUG_FLAGS . GOOD , ` ${ module . label } ` ) ; return true ; }
@param {Module} module
 @returns {Boolean} Whether the module is considered valid or not
@param { Module } module @returns { Boolean } Whether the module is considered valid or not
/* Validate Eris permissions */