mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +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.
|
* Returns `channel.permissionsFor(guildMember)`. Returns evaluated permissions for a member in a guild channel.
|
||||||
* @param {ChannelResolvable} guildChannel the guild channel to use as context
|
* @param {ChannelResolvable} channel Guild channel to use as context
|
||||||
* @returns {?EvaluatedPermissions}
|
* @returns {?EvaluatedPermissions}
|
||||||
*/
|
*/
|
||||||
permissionsIn(guildChannel) {
|
permissionsIn(channel) {
|
||||||
guildChannel = this.client.resolver.resolveChannel(guildChannel);
|
channel = this.client.resolver.resolveChannel(channel);
|
||||||
if (!guildChannel) {
|
if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.');
|
||||||
throw new Error('supply a channel resolvable that resolves to a GuildChannel!');
|
return channel.permissionsFor(this);
|
||||||
}
|
|
||||||
return guildChannel.permissionsFor(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue