mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Add GuildMember.permissionsIn and make ChannelResolvables more lenient
This commit is contained in:
@@ -167,6 +167,19 @@ class GuildMember {
|
||||
return new EvaluatedPermissions(this, permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `guildChannel.permissionsFor(guildMember)`. Returns evaluated permissions for a member in a guild channel.
|
||||
* @param {ChannelResolvable} guildChannel the guild channel to use as context
|
||||
* @returns {?EvaluatedPermissions}
|
||||
*/
|
||||
permissionsIn(guildChannel) {
|
||||
guildChannel = this.client.resolver.resolveChannel(guildChannel);
|
||||
if (!guildChannel) {
|
||||
throw new Error('supply a channel resolvable that resolves to a GuildChannel!');
|
||||
}
|
||||
return guildChannel.permissionsFor(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if any of the member's roles have a permission
|
||||
* @param {PermissionResolvable} permission The permission to check for
|
||||
|
||||
Reference in New Issue
Block a user