import { GuildMember } from 'discord.js' ; import { ConfigurationManager } from './configuration.manager' ; export class PermissionsManager { param member static isGuildManager ( member ) { if ( member . hasPermission ( 'ADMINISTRATOR' , { checkOwner : true } ) ) { return true ; } return this . hasRole ( member , 'guild-manager' ) ; } param member param role protected static hasRole ( member , role ) { const defaultConfigEntry = ConfigurationManager . getDefaultConfiguration ( role ) ; if ( ! defaultConfigEntry ) { return false ; } const roleId = ConfigurationManager . get ( ) . getConfiguration ( role , member . guild . id ) ; if ( roleId === defaultConfigEntry . defaultValue ) { return false ; } return member . roles . cache . has ( roleId ) ; } }