From 28d96e344bb4b4d9dfb7c9b41a04c95c1eecbd25 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sun, 3 Oct 2021 09:01:07 -0400 Subject: [PATCH] feat(Interaction): add memberPermissions (#6741) Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- src/structures/Interaction.js | 7 +++++++ typings/index.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index 369c352e3..82fe70881 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -2,6 +2,7 @@ const Base = require('./Base'); const { InteractionTypes, MessageComponentTypes } = require('../util/Constants'); +const Permissions = require('../util/Permissions'); const SnowflakeUtil = require('../util/SnowflakeUtil'); /** @@ -67,6 +68,12 @@ class Interaction extends Base { * @type {number} */ this.version = data.version; + + /** + * The permissions of the member, if one exists, in the channel this interaction was executed in + * @type {?Readonly} + */ + this.memberPermissions = data.member?.permissions ? new Permissions(data.member.permissions).freeze() : null; } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index c824bfa7b..27ad42da4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1056,6 +1056,7 @@ export class Interaction extends Base { public type: InteractionType; public user: User; public version: number; + public memberPermissions: Readonly | null; public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember;