src/structures/commands/BaseCommand.js
/**
     * If the command has additional permissions to check and loop throught them
     * @private
     */
If the command has additional permissions to check and loop throught them
@private
If the command has additional permissions to check and loop throught them @private
async _hasPermissions() {
        if (!this.msgObj.guild || !this.serverMember) return true;
        if (!this.permissions) return true;
        const or = this.permissions.logic == 'OR' && this.permissions.levels.length > 1 ? true : false;
        let result = true;
        for (const level of this.permissions.levels) {
            const type = level.type.toUpperCase().trim();
            switch (type) {
                case "SERVER":
                    if (!this.serverMember.hasPermission(level.name)) {
                        if (or) {
                            result = false;
                            continue;
                        }
                        this.msgObj.reply(`you do not have permission to use this command.\nYou need the \`${level.name}\` permission(s).`)
                            .then(msg => msg.delete({timeout: 5e3}));
                        return false;
                    }
                    if (or) return true;
                    break;
                case "ROLE":
                    if (this.serverMember.roles.cache.find(x => x.name.toLowerCase() === level.name)) {
                        if (or) {
                            result = false;
                            continue;
                        }
                        this.msgObj.reply(`you do not have permission to use this command.\nYou need the \`${level.name}\` role to use this command.`)
                            .then(msg => msg.delete({timeout: 5e3}));
                        return false;
                    }
                    if (or) return true;
                    break;
                case "COMMAND_HANDLED":
                    if (typeof this.permission === 'function' && !await this.permission()) {
                        result = false;
                        continue;
                    }
                    if (or) return true;
                    break;
                default:
                    this.log.error('CMD', `Command '${this.name}' permissions incorrectly configured, unknown type: ${level.type}`);
                    this.send('This command has incorrectly configured permissions, contact the developer if this problem keeps occuring.');
                    return false;
            }
        }
        return result;
    }
async _hasPermissions ( ) { if ( ! this . msgObj . guild || ! this . serverMember ) return true ; if ( ! this . permissions ) return true ; const or = this . permissions . logic == 'OR' && this . permissions . levels . length > 1 ? true : false ; let result = true ; for ( const level of this . permissions . levels ) { const type = level . type . toUpperCase ( ) . trim ( ) ; switch ( type ) { case "SERVER" : if ( ! this . serverMember . hasPermission ( level . name ) ) { if ( or ) { result = false ; continue ; } this . msgObj . reply ( ` \n \` ${ level . name } \` ` ) . then ( msg => msg . delete ( { timeout : 5e3 } ) ) ; return false ; } if ( or ) return true ; break ; case "ROLE" : if ( this . serverMember . roles . cache . find ( x => x . name . toLowerCase ( ) === level . name ) ) { if ( or ) { result = false ; continue ; } this . msgObj . reply ( ` \n \` ${ level . name } \` ` ) . then ( msg => msg . delete ( { timeout : 5e3 } ) ) ; return false ; } if ( or ) return true ; break ; case "COMMAND_HANDLED" : if ( typeof this . permission === 'function' && ! await this . permission ( ) ) { result = false ; continue ; } if ( or ) return true ; break ; default : this . log . error ( 'CMD' , ` ${ this . name } ${ level . type } ` ) ; this . send ( 'This command has incorrectly configured permissions, contact the developer if this problem keeps occuring.' ) ; return false ; } } return result ; }
If the command has additional permissions to check and loop throught them
 @private
If the command has additional permissions to check and loop throught them @private