From 4040aa6cd0472ad2e1fbec5787298dc86da99895 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 08:58:28 -0400 Subject: [PATCH 1/7] Added memberPermissions to Interaction --- src/structures/Interaction.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index 369c352e3ff2..c14b14751c6e 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -3,6 +3,7 @@ const Base = require('./Base'); const { InteractionTypes, MessageComponentTypes } = require('../util/Constants'); const SnowflakeUtil = require('../util/SnowflakeUtil'); +const Permissions = require('../util/Permissions'); /** * Represents an interaction. @@ -67,6 +68,12 @@ class Interaction extends Base { * @type {number} */ this.version = data.version; + + /** + * This member permissions, if exists, in the channel this interaction was sent in + * @type {?Permissions} + */ + this.memberPermissions = data.member?.permissions ? new Permissions( data.member.permissions ) : null; } /** From 6fa9e99928382687b6f72697f8744ffab392e271 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 09:40:19 -0400 Subject: [PATCH 2/7] Update typings and account for permission is 0 --- src/structures/Interaction.js | 2 +- typings/index.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index c14b14751c6e..9c7e3b16c900 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -73,7 +73,7 @@ class Interaction extends Base { * This member permissions, if exists, in the channel this interaction was sent in * @type {?Permissions} */ - this.memberPermissions = data.member?.permissions ? new Permissions( data.member.permissions ) : null; + this.memberPermissions = data.member?.permissions != null ? new Permissions(data.member.permissions) : null; } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index 81409da77508..04cc9281bf17 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1032,6 +1032,7 @@ export class Interaction extends Base { public type: InteractionType; public user: User; public version: number; + public memberPermissions: Permissions | null; public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember; From 75992d2ba1bb722a1befe84c8567dec1b1d272a8 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 10:09:46 -0400 Subject: [PATCH 3/7] Update src/structures/Interaction.js Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> --- src/structures/Interaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index 9c7e3b16c900..bf619c2e4e0e 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -70,7 +70,7 @@ class Interaction extends Base { this.version = data.version; /** - * This member permissions, if exists, in the channel this interaction was sent in + * The permissions of the member, if one exists, in the channel this interaction was executed in * @type {?Permissions} */ this.memberPermissions = data.member?.permissions != null ? new Permissions(data.member.permissions) : null; From 5b212eddf3e26593edd40301576e54e9fa51f463 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 10:16:31 -0400 Subject: [PATCH 4/7] Revert permission 0 check & linted --- src/structures/Interaction.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index bf619c2e4e0e..1f91d5cb8ab5 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -2,8 +2,8 @@ const Base = require('./Base'); const { InteractionTypes, MessageComponentTypes } = require('../util/Constants'); -const SnowflakeUtil = require('../util/SnowflakeUtil'); const Permissions = require('../util/Permissions'); +const SnowflakeUtil = require('../util/SnowflakeUtil'); /** * Represents an interaction. @@ -73,7 +73,7 @@ class Interaction extends Base { * The permissions of the member, if one exists, in the channel this interaction was executed in * @type {?Permissions} */ - this.memberPermissions = data.member?.permissions != null ? new Permissions(data.member.permissions) : null; + this.memberPermissions = data.member?.permissions ? new Permissions(data.member.permissions) : null; } /** From 4f330d72dbe826f1555d345ec57fd680599a277d Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 11:45:24 -0400 Subject: [PATCH 5/7] Update src/structures/Interaction.js Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- src/structures/Interaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index 1f91d5cb8ab5..770fa27dbd2d 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -71,7 +71,7 @@ class Interaction extends Base { /** * The permissions of the member, if one exists, in the channel this interaction was executed in - * @type {?Permissions} + * @type {?Readonly} */ this.memberPermissions = data.member?.permissions ? new Permissions(data.member.permissions) : null; } From b7fb579af29f8ee58a7f687f626fad62268d7770 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 11:45:29 -0400 Subject: [PATCH 6/7] Update src/structures/Interaction.js Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- src/structures/Interaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/Interaction.js b/src/structures/Interaction.js index 770fa27dbd2d..82fe70881a92 100644 --- a/src/structures/Interaction.js +++ b/src/structures/Interaction.js @@ -73,7 +73,7 @@ class Interaction extends Base { * 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) : null; + this.memberPermissions = data.member?.permissions ? new Permissions(data.member.permissions).freeze() : null; } /** From d635e3a9acdca51adde8e6339f58da3906306441 Mon Sep 17 00:00:00 2001 From: ObscuritySRL Date: Sat, 2 Oct 2021 11:45:42 -0400 Subject: [PATCH 7/7] Update typings/index.d.ts Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- typings/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 04cc9281bf17..b57914a221b0 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1032,7 +1032,7 @@ export class Interaction extends Base { public type: InteractionType; public user: User; public version: number; - public memberPermissions: Permissions | null; + public memberPermissions: Readonly | null; public inGuild(): this is this & { guildId: Snowflake; member: GuildMember | APIInteractionGuildMember;