mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 23:21:04 +00:00
Webpack build for branch master: 566135d25b
This commit is contained in:
parent
9454b062c4
commit
f27246a4a3
2 changed files with 23 additions and 15 deletions
|
|
@ -1547,11 +1547,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1567,10 +1563,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -9104,6 +9098,20 @@ class ClientDataResolver {
|
|||
return bitfield;
|
||||
}
|
||||
|
||||
hasPermission(bitfield, name, explicit = false) {
|
||||
const permission = this.resolvePermission(name);
|
||||
if (!explicit && (bitfield & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true;
|
||||
return (bitfield & permission) > 0;
|
||||
}
|
||||
|
||||
serializePermissions(bitfield) {
|
||||
const serializedPermissions = {};
|
||||
for (const name in Constants.PermissionFlags) {
|
||||
serializedPermissions[name] = this.hasPermission(bitfield, name);
|
||||
}
|
||||
return serializedPermissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data that can be resolved to give a string. This can be:
|
||||
* * A string
|
||||
|
|
|
|||
12
discord.master.min.js
vendored
12
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue