Improve GuildMember.permissionsIn failure

This commit is contained in:
Schuyler Cebulskie
2016-09-11 11:08:54 -04:00
parent 21ad5668ba
commit a52beaa78d
2 changed files with 7 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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);
}
/**