mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 06:31:20 +00:00
change role hasPermission to return true for administrator (#525)
* change role hasPermission to return true for administrator rather than manageRoles * add administrator to Role.serialize()
This commit is contained in:
parent
1c7a5abd4e
commit
3e39d54933
2 changed files with 4 additions and 2 deletions
|
|
@ -81,6 +81,7 @@ var Role = (function () {
|
|||
manageRoles: hp(_Constants.Permissions.manageRoles),
|
||||
manageChannels: hp(_Constants.Permissions.manageChannels),
|
||||
manageServer: hp(_Constants.Permissions.manageServer),
|
||||
administrator: hp(_Constants.Permissions.administrator),
|
||||
// text
|
||||
readMessages: hp(_Constants.Permissions.readMessages),
|
||||
sendMessages: hp(_Constants.Permissions.sendMessages),
|
||||
|
|
@ -116,7 +117,7 @@ var Role = (function () {
|
|||
}
|
||||
if (!explicit) {
|
||||
// implicit permissions allowed
|
||||
if (!!(this.permissions & _Constants.Permissions.manageRoles)) {
|
||||
if (!!(this.permissions & _Constants.Permissions.administrator)) {
|
||||
// manageRoles allowed, they have all permissions
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ export default class Role {
|
|||
manageRoles : hp ( Permissions.manageRoles ),
|
||||
manageChannels : hp( Permissions.manageChannels ),
|
||||
manageServer : hp( Permissions.manageServer ),
|
||||
administrator: hp( Permissions.administrator ),
|
||||
// text
|
||||
readMessages : hp( Permissions.readMessages ),
|
||||
sendMessages : hp( Permissions.sendMessages ),
|
||||
|
|
@ -102,7 +103,7 @@ export default class Role {
|
|||
return false;
|
||||
}
|
||||
if(!explicit){ // implicit permissions allowed
|
||||
if( !!(this.permissions & Permissions.manageRoles) ){
|
||||
if( !!(this.permissions & Permissions.administrator) ){
|
||||
// manageRoles allowed, they have all permissions
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue