mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
Improve GuildMember.permissionsIn failure
This commit is contained in:
parent
21ad5668ba
commit
a52beaa78d
2 changed files with 7 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
|
@ -168,16 +168,14 @@ class GuildMember {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 `channel.permissionsFor(guildMember)`. Returns evaluated permissions for a member in a guild channel.
|
||||
* @param {ChannelResolvable} channel 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);
|
||||
permissionsIn(channel) {
|
||||
channel = this.client.resolver.resolveChannel(channel);
|
||||
if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.');
|
||||
return channel.permissionsFor(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue