GuildChannel.permissionsFor(role) (#2254)

* GuildChannel.permissionsFor(role)

* 1Comp's requested changes
This commit is contained in:
bdistin
2018-01-18 02:28:14 -06:00
committed by Isabella
parent d5b0cf9ffb
commit b846cbd2b3
3 changed files with 69 additions and 26 deletions

View File

@@ -195,6 +195,18 @@ class Role extends Base {
});
}
/**
* Returns `channel.permissionsFor(role)`. Returns permissions for a role in a guild channel,
* taking into account permission overwrites.
* @param {ChannelResolvable} channel The guild channel to use as context
* @returns {?Permissions}
*/
permissionsIn(channel) {
channel = this.guild.channels.resolve(channel);
if (!channel) throw new Error('GUILD_CHANNEL_RESOLVE');
return channel.rolePermissions(this);
}
/**
* Sets a new name for the role.
* @param {string} name The new name of the role