mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Improve GuildMember.permissionsIn failure
This commit is contained in:
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user