diff --git a/index.d.ts b/index.d.ts index af83e38c3..438436773 100644 --- a/index.d.ts +++ b/index.d.ts @@ -799,6 +799,9 @@ declare namespace Eris { id: string; user: User; } + interface MemberRoles extends BaseData { + roles: string[]; + } interface PartialUser { avatar: string | null; discriminator: string; @@ -2062,7 +2065,7 @@ declare namespace Eris { kickMember(userID: string, reason?: string): Promise; leave(): Promise; leaveVoiceChannel(): void; - permissionsOf(memberID: string | Member): Permission; + permissionsOf(memberID: string | Member | MemberRoles): Permission; pruneMembers(options?: PruneMemberOptions): Promise; removeMemberRole(memberID: string, roleID: string, reason?: string): Promise; searchMembers(query: string, limit?: number): Promise; @@ -2112,7 +2115,7 @@ declare namespace Eris { ): Promise; editPosition(position: number, options?: EditChannelPositionOptions): Promise; getInvites(): Promise; - permissionsOf(memberID: string | Member): Permission; + permissionsOf(memberID: string | Member | MemberRoles): Permission; } export class GuildIntegration extends Base { diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index 1588bb025..8d27af959 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -898,11 +898,11 @@ class Guild extends Base { /** * Get the guild permissions of a member - * @arg {String | Member} memberID The ID of the member or a Member instance + * @arg {String | Member | Object} memberID The ID of the member or a Member object * @returns {Permission} */ permissionsOf(memberID) { - const member = memberID instanceof Member ? memberID : this.members.get(memberID); + const member = typeof memberID === "string" ? this.members.get(memberID) : memberID; if(member.id === this.ownerID) { return new Permission(Permissions.all); } else { diff --git a/lib/structures/GuildChannel.js b/lib/structures/GuildChannel.js index 80f950d68..e17ee2ff6 100644 --- a/lib/structures/GuildChannel.js +++ b/lib/structures/GuildChannel.js @@ -2,7 +2,6 @@ const Channel = require("./Channel"); const Collection = require("../util/Collection"); -const Member = require("./Member"); const Permission = require("./Permission"); const {Permissions} = require("../Constants"); const PermissionOverwrite = require("./PermissionOverwrite"); @@ -115,11 +114,11 @@ class GuildChannel extends Channel { /** * Get the channel-specific permissions of a member - * @arg {String | Member} memberID The ID of the member or a Member instance + * @arg {String | Member | Object} memberID The ID of the member or a Member object * @returns {Permission} */ permissionsOf(memberID) { - const member = memberID instanceof Member ? memberID : this.guild.members.get(memberID); + const member = typeof memberID === "string" ? this.guild.members.get(memberID) : memberID; let permission = this.guild.permissionsOf(member).allow; if(permission & Permissions.administrator) { return new Permission(Permissions.all);