mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +00:00
Add GuildMember.hasPermissions
This commit is contained in:
parent
3fba72107b
commit
9e05caec0d
2 changed files with 11 additions and 1 deletions
File diff suppressed because one or more lines are too long
|
|
@ -191,6 +191,16 @@ class GuildMember {
|
||||||
return this.roles.some(r => r.hasPermission(permission, explicit));
|
return this.roles.some(r => r.hasPermission(permission, explicit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the roles of the members allow them to perform specific actions.
|
||||||
|
* @param {Array<PermissionResolvable>} permissions the permissions to test for
|
||||||
|
* @param {boolean} [explicit=false] whether to require the member to explicitly have the exact permissions
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
hasPermissions(permissions, explicit = false) {
|
||||||
|
return permissions.map(p => this.hasPermission(p, explicit)).every(v => v);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute/unmute a user
|
* Mute/unmute a user
|
||||||
* @param {boolean} mute Whether or not the member should be muted
|
* @param {boolean} mute Whether or not the member should be muted
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue