mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
move permission stuff to the resolver (#1185)
This commit is contained in:
@@ -140,11 +140,7 @@ class Role {
|
||||
* console.log(role.serialize());
|
||||
*/
|
||||
serialize() {
|
||||
const serializedPermissions = {};
|
||||
for (const permissionName in Constants.PermissionFlags) {
|
||||
serializedPermissions[permissionName] = this.hasPermission(permissionName);
|
||||
}
|
||||
return serializedPermissions;
|
||||
return this.client.resolver.serializePermissions(this.permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,10 +156,8 @@ class Role {
|
||||
* console.log('This role can\'t ban members');
|
||||
* }
|
||||
*/
|
||||
hasPermission(permission, explicit = false) {
|
||||
permission = this.client.resolver.resolvePermission(permission);
|
||||
if (!explicit && (this.permissions & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true;
|
||||
return (this.permissions & permission) > 0;
|
||||
hasPermission(permission, explicit) {
|
||||
return this.client.resolver.hasPermission(this.permissions, permission, explicit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user