feat(Permissions): add checkAdmin to permission overwrite checks (#6847)

This commit is contained in:
ckohen
2021-10-16 15:27:52 -07:00
committed by GitHub
parent e8b69974dc
commit 7513b4528c
4 changed files with 34 additions and 19 deletions

View File

@@ -232,12 +232,13 @@ class Role extends Base {
* Returns `channel.permissionsFor(role)`. Returns permissions for a role in a guild channel,
* taking into account permission overwrites.
* @param {GuildChannel|Snowflake} channel The guild channel to use as context
* @param {boolean} [checkAdmin=true] Whether having `ADMINISTRATOR` will return all permissions
* @returns {Readonly<Permissions>}
*/
permissionsIn(channel) {
permissionsIn(channel, checkAdmin = true) {
channel = this.guild.channels.resolve(channel);
if (!channel) throw new Error('GUILD_CHANNEL_RESOLVE');
return channel.rolePermissions(this);
return channel.rolePermissions(this, checkAdmin);
}
/**