From b2fabd130a76ea54cfbfa1b871ef8659513c2c7a Mon Sep 17 00:00:00 2001 From: Jaworek Date: Sat, 19 Nov 2022 22:27:14 +0100 Subject: [PATCH] feat(SelectMenuInteractions): add `values` property (#8805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: add values property * fix: improve wording * Update packages/discord.js/src/structures/MentionableSelectMenuInteraction.js Co-authored-by: Aura Román Co-authored-by: Aura Román Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../ChannelSelectMenuInteraction.js | 6 +++++ .../MentionableSelectMenuInteraction.js | 6 +++++ .../structures/RoleSelectMenuInteraction.js | 6 +++++ .../structures/UserSelectMenuInteraction.js | 6 +++++ packages/discord.js/typings/index.d.ts | 23 +++++++++++++++---- 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/packages/discord.js/src/structures/ChannelSelectMenuInteraction.js b/packages/discord.js/src/structures/ChannelSelectMenuInteraction.js index 04d076e599f0..0e28c01edd6d 100644 --- a/packages/discord.js/src/structures/ChannelSelectMenuInteraction.js +++ b/packages/discord.js/src/structures/ChannelSelectMenuInteraction.js @@ -11,6 +11,12 @@ class ChannelSelectMenuInteraction extends MessageComponentInteraction { constructor(client, data) { super(client, data); + /** + * An array of the selected channel ids + * @type {Snowflake[]} + */ + this.values = data.data.values ?? []; + /** * Collection of the selected channels * @type {Collection} diff --git a/packages/discord.js/src/structures/MentionableSelectMenuInteraction.js b/packages/discord.js/src/structures/MentionableSelectMenuInteraction.js index bd294a04a74a..4e14bda6137b 100644 --- a/packages/discord.js/src/structures/MentionableSelectMenuInteraction.js +++ b/packages/discord.js/src/structures/MentionableSelectMenuInteraction.js @@ -12,6 +12,12 @@ class MentionableSelectMenuInteraction extends MessageComponentInteraction { constructor(client, data) { super(client, data); + /** + * An array of the selected user and role ids + * @type {Snowflake[]} + */ + this.values = data.data.values ?? []; + const { members, users, roles } = data.data.resolved ?? {}; /** diff --git a/packages/discord.js/src/structures/RoleSelectMenuInteraction.js b/packages/discord.js/src/structures/RoleSelectMenuInteraction.js index b45d356a2828..7c7896329156 100644 --- a/packages/discord.js/src/structures/RoleSelectMenuInteraction.js +++ b/packages/discord.js/src/structures/RoleSelectMenuInteraction.js @@ -11,6 +11,12 @@ class RoleSelectMenuInteraction extends MessageComponentInteraction { constructor(client, data) { super(client, data); + /** + * An array of the selected role ids + * @type {Snowflake[]} + */ + this.values = data.data.values ?? []; + /** * Collection of the selected roles * @type {Collection} diff --git a/packages/discord.js/src/structures/UserSelectMenuInteraction.js b/packages/discord.js/src/structures/UserSelectMenuInteraction.js index d2af4176a5e7..f6d2623a93ab 100644 --- a/packages/discord.js/src/structures/UserSelectMenuInteraction.js +++ b/packages/discord.js/src/structures/UserSelectMenuInteraction.js @@ -12,6 +12,12 @@ class UserSelectMenuInteraction extends MessageComponentInteraction { constructor(client, data) { super(client, data); + /** + * An array of the selected user ids + * @type {Snowflake[]} + */ + this.values = data.data.values ?? []; + /** * Collection of the selected users * @type {Collection} diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 542f29fc769a..7aa467adbc79 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2371,8 +2371,12 @@ export class UserSelectMenuInteraction< UserSelectMenuComponent | APIUserSelectComponent >; public componentType: ComponentType.UserSelect; + public values: Snowflake[]; public users: Collection; - public members: Collection>; + public members: Collection< + Snowflake, + CacheTypeReducer + >; public inGuild(): this is UserSelectMenuInteraction<'raw' | 'cached'>; public inCachedGuild(): this is UserSelectMenuInteraction<'cached'>; public inRawGuild(): this is UserSelectMenuInteraction<'raw'>; @@ -2390,7 +2394,8 @@ export class RoleSelectMenuInteraction< RoleSelectMenuComponent | APIRoleSelectComponent >; public componentType: ComponentType.RoleSelect; - public roles: Collection>; + public values: Snowflake[]; + public roles: Collection>; public inGuild(): this is RoleSelectMenuInteraction<'raw' | 'cached'>; public inCachedGuild(): this is RoleSelectMenuInteraction<'cached'>; public inRawGuild(): this is RoleSelectMenuInteraction<'raw'>; @@ -2408,9 +2413,13 @@ export class MentionableSelectMenuInteraction< MentionableSelectMenuComponent | APIMentionableSelectComponent >; public componentType: ComponentType.MentionableSelect; + public values: Snowflake[]; public users: Collection; - public members: Collection>; - public roles: Collection>; + public members: Collection< + Snowflake, + CacheTypeReducer + >; + public roles: Collection>; public inGuild(): this is MentionableSelectMenuInteraction<'raw' | 'cached'>; public inCachedGuild(): this is MentionableSelectMenuInteraction<'cached'>; public inRawGuild(): this is MentionableSelectMenuInteraction<'raw'>; @@ -2428,7 +2437,11 @@ export class ChannelSelectMenuInteraction< ChannelSelectMenuComponent | APIChannelSelectComponent >; public componentType: ComponentType.ChannelSelect; - public channels: Collection>; + public values: Snowflake[]; + public channels: Collection< + Snowflake, + CacheTypeReducer + >; public inGuild(): this is ChannelSelectMenuInteraction<'raw' | 'cached'>; public inCachedGuild(): this is ChannelSelectMenuInteraction<'cached'>; public inRawGuild(): this is ChannelSelectMenuInteraction<'raw'>;