diff --git a/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts b/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts index bd49cbe3..1ea67b2b 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts @@ -43,14 +43,8 @@ import type { APIApplicationCommandUserOption, } from './_chatInput/user.ts'; import type { APIBaseApplicationCommandInteractionData } from './internals.ts'; -import type { Snowflake } from '../../../../globals.ts'; -import type { APIAttachment, APIRole, APIUser } from '../../mod.ts'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedChannel, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands.ts'; +import type { APIInteractionDataResolved } from '../../mod.ts'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts'; import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts'; export * from './_chatInput/attachment.ts'; @@ -114,18 +108,7 @@ export type APIApplicationCommandInteractionDataBasicOption = export interface APIChatInputApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { options?: APIApplicationCommandInteractionDataOption[]; - resolved?: APIChatInputApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIChatInputApplicationCommandInteractionDataResolved { - users?: Record; - roles?: Record; - members?: Record; - channels?: Record; - attachments?: Record; + resolved?: APIInteractionDataResolved; } /** diff --git a/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts b/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts index c4c22b0f..e5644f5a 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts @@ -1,13 +1,8 @@ import type { APIBaseApplicationCommandInteractionData } from './internals.ts'; import type { Snowflake } from '../../../../globals.ts'; import type { APIMessage } from '../../channel.ts'; -import type { APIUser } from '../../user.ts'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands.ts'; -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts'; +import type { APIDMInteractionWrapper, APIGuildInteractionWrapper, APIUserInteractionDataResolved } from '../base.ts'; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data @@ -15,15 +10,7 @@ import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../bas export interface APIUserApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { target_id: Snowflake; - resolved: APIUserApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIUserApplicationCommandInteractionDataResolved { - users: Record; - members?: Record; + resolved: APIUserInteractionDataResolved; } /** diff --git a/deno/payloads/v10/_interactions/applicationCommands.ts b/deno/payloads/v10/_interactions/applicationCommands.ts index 6b3e5bbf..b13a714b 100644 --- a/deno/payloads/v10/_interactions/applicationCommands.ts +++ b/deno/payloads/v10/_interactions/applicationCommands.ts @@ -15,8 +15,6 @@ import type { APIBaseInteraction } from './base.ts'; import type { InteractionType } from './responses.ts'; import type { Permissions, Snowflake } from '../../../globals.ts'; import type { LocalizationMap } from '../../../v10.ts'; -import type { APIPartialChannel, APIThreadMetadata } from '../channel.ts'; -import type { APIGuildMember } from '../guild.ts'; export * from './_applicationCommands/chatInput.ts'; export * from './_applicationCommands/contextMenu.ts'; @@ -107,22 +105,6 @@ export type APIApplicationCommandInteractionData = | APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData; -/** - * https://discord.com/developers/docs/resources/channel#channel-object - */ -export interface APIInteractionDataResolvedChannel extends Required { - thread_metadata?: APIThreadMetadata | null; - permissions: Permissions; - parent_id?: string | null; -} - -/** - * https://discord.com/developers/docs/resources/guild#guild-member-object - */ -export interface APIInteractionDataResolvedGuildMember extends Omit { - permissions: Permissions; -} - /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ diff --git a/deno/payloads/v10/_interactions/base.ts b/deno/payloads/v10/_interactions/base.ts index e06fe084..7fe280a4 100644 --- a/deno/payloads/v10/_interactions/base.ts +++ b/deno/payloads/v10/_interactions/base.ts @@ -1,7 +1,7 @@ import type { InteractionType } from './responses.ts'; import type { Permissions, Snowflake } from '../../../globals.ts'; -import type { LocaleString } from '../../../v10.ts'; -import type { APIMessage } from '../channel.ts'; +import type { APIRole, LocaleString } from '../../../v10.ts'; +import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts'; import type { APIGuildMember } from '../guild.ts'; import type { APIUser } from '../user.ts'; @@ -129,3 +129,46 @@ export type APIGuildInteractionWrapper & Required>; + +/** + * https://discord.com/developers/docs/resources/channel#channel-object + */ +export interface APIInteractionDataResolvedChannel extends Required { + thread_metadata?: APIThreadMetadata | null; + permissions: Permissions; + parent_id?: string | null; +} + +/** + * https://discord.com/developers/docs/resources/guild#guild-member-object + */ +export interface APIInteractionDataResolvedGuildMember extends Omit { + permissions: Permissions; +} + +/** + * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure + */ +export interface APIInteractionDataResolved { + users?: Record; + roles?: Record; + members?: Record; + channels?: Record; + attachments?: Record; +} + +/** + * @deprecated Renamed to `APIInteractionDataResolved` + */ +export type APIChatInputApplicationCommandInteractionDataResolved = APIInteractionDataResolved; + +/** + * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects + */ +export type APIUserInteractionDataResolved = Required> & + Pick; + +/** + * @deprecated Renamed to `APIUserInteractionDataResolved` + */ +export type APIUserApplicationCommandInteractionDataResolved = APIUserInteractionDataResolved; diff --git a/deno/payloads/v10/_interactions/messageComponents.ts b/deno/payloads/v10/_interactions/messageComponents.ts index ade50b6c..d2d802ab 100644 --- a/deno/payloads/v10/_interactions/messageComponents.ts +++ b/deno/payloads/v10/_interactions/messageComponents.ts @@ -1,4 +1,10 @@ -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts'; +import type { + APIDMInteractionWrapper, + APIGuildInteractionWrapper, + APIInteractionDataResolved, + APIUserInteractionDataResolved, +} from './base.ts'; +import type { Snowflake } from '../../../globals.ts'; import type { ComponentType } from '../channel.ts'; import type { APIBaseInteraction, InteractionType } from '../interactions.ts'; @@ -50,11 +56,42 @@ export interface APIMessageComponentBaseInteractionData; -export interface APIMessageSelectMenuInteractionData - extends APIMessageComponentBaseInteractionData { +export interface APIMessageStringSelectInteractionData + extends APIMessageComponentBaseInteractionData { values: string[]; } +export interface APIMessageUserSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: APIUserInteractionDataResolved; +} + +export interface APIMessageRoleSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export interface APIMessageMentionableSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Pick; +} + +export interface APIMessageChannelSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export type APIMessageSelectMenuInteractionData = + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData + | APIMessageRoleSelectInteractionData + | APIMessageMentionableSelectInteractionData + | APIMessageChannelSelectInteractionData; + export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper; diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index a59238ba..43355e17 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -1313,13 +1313,38 @@ export enum ComponentType { */ Button, /** - * Select Menu component + * Select menu for picking from defined text options */ - SelectMenu, + StringSelect, /** * Text Input component */ TextInput, + /** + * Select menu for users + */ + UserSelect, + /** + * Select menu for roles + */ + RoleSelect, + /** + * Select menu for users and roles + */ + MentionableSelect, + /** + * Select menu for channels + */ + ChannelSelect, + + // EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS // + + /** + * Select menu for picking from defined text options + * + * @deprecated This is the old name for {@apilink ComponentType#StringSelect} + */ + SelectMenu = 3, } /** @@ -1411,15 +1436,18 @@ export enum TextInputStyle { /** * https://discord.com/developers/docs/interactions/message-components#select-menus */ -export interface APISelectMenuComponent extends APIBaseComponent { +export interface APIBaseSelectMenuComponent< + T extends + | ComponentType.StringSelect + | ComponentType.UserSelect + | ComponentType.RoleSelect + | ComponentType.MentionableSelect + | ComponentType.ChannelSelect, +> extends APIBaseComponent { /** * A developer-defined identifier for the select menu, max 100 characters */ custom_id: string; - /** - * The choices in the select, max 25 - */ - options: APISelectMenuOption[]; /** * Custom placeholder text if nothing is selected, max 150 characters */ @@ -1444,6 +1472,51 @@ export interface APISelectMenuComponent extends APIBaseComponent { + /** + * Specified choices in a select menu; max 25 + */ + options: APISelectMenuOption[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIUserSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIRoleSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIMentionableSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export interface APIChannelSelectComponent extends APIBaseSelectMenuComponent { + /** + * List of channel types to include in the ChannelSelect component + */ + channel_types?: ChannelType[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APISelectMenuComponent = + | APIStringSelectComponent + | APIUserSelectComponent + | APIRoleSelectComponent + | APIMentionableSelectComponent + | APIChannelSelectComponent; + /** * https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */ diff --git a/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts b/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts index bd49cbe3..1ea67b2b 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts @@ -43,14 +43,8 @@ import type { APIApplicationCommandUserOption, } from './_chatInput/user.ts'; import type { APIBaseApplicationCommandInteractionData } from './internals.ts'; -import type { Snowflake } from '../../../../globals.ts'; -import type { APIAttachment, APIRole, APIUser } from '../../mod.ts'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedChannel, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands.ts'; +import type { APIInteractionDataResolved } from '../../mod.ts'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts'; import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts'; export * from './_chatInput/attachment.ts'; @@ -114,18 +108,7 @@ export type APIApplicationCommandInteractionDataBasicOption = export interface APIChatInputApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { options?: APIApplicationCommandInteractionDataOption[]; - resolved?: APIChatInputApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIChatInputApplicationCommandInteractionDataResolved { - users?: Record; - roles?: Record; - members?: Record; - channels?: Record; - attachments?: Record; + resolved?: APIInteractionDataResolved; } /** diff --git a/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts b/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts index c4c22b0f..e5644f5a 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts @@ -1,13 +1,8 @@ import type { APIBaseApplicationCommandInteractionData } from './internals.ts'; import type { Snowflake } from '../../../../globals.ts'; import type { APIMessage } from '../../channel.ts'; -import type { APIUser } from '../../user.ts'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands.ts'; -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts'; +import type { APIDMInteractionWrapper, APIGuildInteractionWrapper, APIUserInteractionDataResolved } from '../base.ts'; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data @@ -15,15 +10,7 @@ import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../bas export interface APIUserApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { target_id: Snowflake; - resolved: APIUserApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIUserApplicationCommandInteractionDataResolved { - users: Record; - members?: Record; + resolved: APIUserInteractionDataResolved; } /** diff --git a/deno/payloads/v9/_interactions/applicationCommands.ts b/deno/payloads/v9/_interactions/applicationCommands.ts index 5c0e86c8..32e34572 100644 --- a/deno/payloads/v9/_interactions/applicationCommands.ts +++ b/deno/payloads/v9/_interactions/applicationCommands.ts @@ -15,8 +15,6 @@ import type { APIBaseInteraction } from './base.ts'; import type { InteractionType } from './responses.ts'; import type { Permissions, Snowflake } from '../../../globals.ts'; import type { LocalizationMap } from '../../../v9.ts'; -import type { APIPartialChannel, APIThreadMetadata } from '../channel.ts'; -import type { APIGuildMember } from '../guild.ts'; export * from './_applicationCommands/chatInput.ts'; export * from './_applicationCommands/contextMenu.ts'; @@ -107,22 +105,6 @@ export type APIApplicationCommandInteractionData = | APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData; -/** - * https://discord.com/developers/docs/resources/channel#channel-object - */ -export interface APIInteractionDataResolvedChannel extends Required { - thread_metadata?: APIThreadMetadata | null; - permissions: Permissions; - parent_id?: string | null; -} - -/** - * https://discord.com/developers/docs/resources/guild#guild-member-object - */ -export interface APIInteractionDataResolvedGuildMember extends Omit { - permissions: Permissions; -} - /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ diff --git a/deno/payloads/v9/_interactions/base.ts b/deno/payloads/v9/_interactions/base.ts index cb265bed..792104ff 100644 --- a/deno/payloads/v9/_interactions/base.ts +++ b/deno/payloads/v9/_interactions/base.ts @@ -1,7 +1,7 @@ import type { InteractionType } from './responses.ts'; import type { Permissions, Snowflake } from '../../../globals.ts'; -import type { LocaleString } from '../../../v9.ts'; -import type { APIMessage } from '../channel.ts'; +import type { APIRole, LocaleString } from '../../../v9.ts'; +import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel.ts'; import type { APIGuildMember } from '../guild.ts'; import type { APIUser } from '../user.ts'; @@ -129,3 +129,46 @@ export type APIGuildInteractionWrapper & Required>; + +/** + * https://discord.com/developers/docs/resources/channel#channel-object + */ +export interface APIInteractionDataResolvedChannel extends Required { + thread_metadata?: APIThreadMetadata | null; + permissions: Permissions; + parent_id?: string | null; +} + +/** + * https://discord.com/developers/docs/resources/guild#guild-member-object + */ +export interface APIInteractionDataResolvedGuildMember extends Omit { + permissions: Permissions; +} + +/** + * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure + */ +export interface APIInteractionDataResolved { + users?: Record; + roles?: Record; + members?: Record; + channels?: Record; + attachments?: Record; +} + +/** + * @deprecated Renamed to `APIInteractionDataResolved` + */ +export type APIChatInputApplicationCommandInteractionDataResolved = APIInteractionDataResolved; + +/** + * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects + */ +export type APIUserInteractionDataResolved = Required> & + Pick; + +/** + * @deprecated Renamed to `APIUserInteractionDataResolved` + */ +export type APIUserApplicationCommandInteractionDataResolved = APIUserInteractionDataResolved; diff --git a/deno/payloads/v9/_interactions/messageComponents.ts b/deno/payloads/v9/_interactions/messageComponents.ts index ade50b6c..d2d802ab 100644 --- a/deno/payloads/v9/_interactions/messageComponents.ts +++ b/deno/payloads/v9/_interactions/messageComponents.ts @@ -1,4 +1,10 @@ -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts'; +import type { + APIDMInteractionWrapper, + APIGuildInteractionWrapper, + APIInteractionDataResolved, + APIUserInteractionDataResolved, +} from './base.ts'; +import type { Snowflake } from '../../../globals.ts'; import type { ComponentType } from '../channel.ts'; import type { APIBaseInteraction, InteractionType } from '../interactions.ts'; @@ -50,11 +56,42 @@ export interface APIMessageComponentBaseInteractionData; -export interface APIMessageSelectMenuInteractionData - extends APIMessageComponentBaseInteractionData { +export interface APIMessageStringSelectInteractionData + extends APIMessageComponentBaseInteractionData { values: string[]; } +export interface APIMessageUserSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: APIUserInteractionDataResolved; +} + +export interface APIMessageRoleSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export interface APIMessageMentionableSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Pick; +} + +export interface APIMessageChannelSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export type APIMessageSelectMenuInteractionData = + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData + | APIMessageRoleSelectInteractionData + | APIMessageMentionableSelectInteractionData + | APIMessageChannelSelectInteractionData; + export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper; diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index e7591a50..f0a6e905 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -1312,13 +1312,38 @@ export enum ComponentType { */ Button, /** - * Select Menu component + * Select menu for picking from defined text options */ - SelectMenu, + StringSelect, /** * Text Input component */ TextInput, + /** + * Select menu for users + */ + UserSelect, + /** + * Select menu for roles + */ + RoleSelect, + /** + * Select menu for users and roles + */ + MentionableSelect, + /** + * Select menu for channels + */ + ChannelSelect, + + // EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS // + + /** + * Select menu for picking from defined text options + * + * @deprecated This is the old name for {@apilink ComponentType#StringSelect} + */ + SelectMenu = 3, } /** @@ -1410,15 +1435,18 @@ export enum TextInputStyle { /** * https://discord.com/developers/docs/interactions/message-components#select-menus */ -export interface APISelectMenuComponent extends APIBaseComponent { +export interface APIBaseSelectMenuComponent< + T extends + | ComponentType.StringSelect + | ComponentType.UserSelect + | ComponentType.RoleSelect + | ComponentType.MentionableSelect + | ComponentType.ChannelSelect, +> extends APIBaseComponent { /** * A developer-defined identifier for the select menu, max 100 characters */ custom_id: string; - /** - * The choices in the select, max 25 - */ - options: APISelectMenuOption[]; /** * Custom placeholder text if nothing is selected, max 150 characters */ @@ -1443,6 +1471,51 @@ export interface APISelectMenuComponent extends APIBaseComponent { + /** + * Specified choices in a select menu; max 25 + */ + options: APISelectMenuOption[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIUserSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIRoleSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIMentionableSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export interface APIChannelSelectComponent extends APIBaseSelectMenuComponent { + /** + * List of channel types to include in the ChannelSelect component + */ + channel_types?: ChannelType[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APISelectMenuComponent = + | APIStringSelectComponent + | APIUserSelectComponent + | APIRoleSelectComponent + | APIMentionableSelectComponent + | APIChannelSelectComponent; + /** * https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */ diff --git a/deno/utils/v10.ts b/deno/utils/v10.ts index 87928f56..a5a45ef2 100644 --- a/deno/utils/v10.ts +++ b/deno/utils/v10.ts @@ -141,7 +141,13 @@ export function isMessageComponentButtonInteraction( export function isMessageComponentSelectMenuInteraction( interaction: APIMessageComponentInteraction, ): interaction is APIMessageComponentSelectMenuInteraction { - return interaction.data.component_type === ComponentType.SelectMenu; + return [ + ComponentType.StringSelect, + ComponentType.UserSelect, + ComponentType.RoleSelect, + ComponentType.MentionableSelect, + ComponentType.ChannelSelect, + ].includes(interaction.data.component_type); } // Application Commands diff --git a/deno/utils/v9.ts b/deno/utils/v9.ts index a1a03fce..dad8af23 100644 --- a/deno/utils/v9.ts +++ b/deno/utils/v9.ts @@ -141,7 +141,13 @@ export function isMessageComponentButtonInteraction( export function isMessageComponentSelectMenuInteraction( interaction: APIMessageComponentInteraction, ): interaction is APIMessageComponentSelectMenuInteraction { - return interaction.data.component_type === ComponentType.SelectMenu; + return [ + ComponentType.StringSelect, + ComponentType.UserSelect, + ComponentType.RoleSelect, + ComponentType.MentionableSelect, + ComponentType.ChannelSelect, + ].includes(interaction.data.component_type); } // Application Commands diff --git a/payloads/v10/_interactions/_applicationCommands/chatInput.ts b/payloads/v10/_interactions/_applicationCommands/chatInput.ts index b1cddade..e0c34d7d 100644 --- a/payloads/v10/_interactions/_applicationCommands/chatInput.ts +++ b/payloads/v10/_interactions/_applicationCommands/chatInput.ts @@ -43,14 +43,8 @@ import type { APIApplicationCommandUserOption, } from './_chatInput/user'; import type { APIBaseApplicationCommandInteractionData } from './internals'; -import type { Snowflake } from '../../../../globals'; -import type { APIAttachment, APIRole, APIUser } from '../../index'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedChannel, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands'; +import type { APIInteractionDataResolved } from '../../index'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands'; import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base'; export * from './_chatInput/attachment'; @@ -114,18 +108,7 @@ export type APIApplicationCommandInteractionDataBasicOption = export interface APIChatInputApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { options?: APIApplicationCommandInteractionDataOption[]; - resolved?: APIChatInputApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIChatInputApplicationCommandInteractionDataResolved { - users?: Record; - roles?: Record; - members?: Record; - channels?: Record; - attachments?: Record; + resolved?: APIInteractionDataResolved; } /** diff --git a/payloads/v10/_interactions/_applicationCommands/contextMenu.ts b/payloads/v10/_interactions/_applicationCommands/contextMenu.ts index 5db54107..a56542eb 100644 --- a/payloads/v10/_interactions/_applicationCommands/contextMenu.ts +++ b/payloads/v10/_interactions/_applicationCommands/contextMenu.ts @@ -1,13 +1,8 @@ import type { APIBaseApplicationCommandInteractionData } from './internals'; import type { Snowflake } from '../../../../globals'; import type { APIMessage } from '../../channel'; -import type { APIUser } from '../../user'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands'; -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands'; +import type { APIDMInteractionWrapper, APIGuildInteractionWrapper, APIUserInteractionDataResolved } from '../base'; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data @@ -15,15 +10,7 @@ import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../bas export interface APIUserApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { target_id: Snowflake; - resolved: APIUserApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIUserApplicationCommandInteractionDataResolved { - users: Record; - members?: Record; + resolved: APIUserInteractionDataResolved; } /** diff --git a/payloads/v10/_interactions/applicationCommands.ts b/payloads/v10/_interactions/applicationCommands.ts index c6c35d66..d8fb43ed 100644 --- a/payloads/v10/_interactions/applicationCommands.ts +++ b/payloads/v10/_interactions/applicationCommands.ts @@ -15,8 +15,6 @@ import type { APIBaseInteraction } from './base'; import type { InteractionType } from './responses'; import type { Permissions, Snowflake } from '../../../globals'; import type { LocalizationMap } from '../../../v10'; -import type { APIPartialChannel, APIThreadMetadata } from '../channel'; -import type { APIGuildMember } from '../guild'; export * from './_applicationCommands/chatInput'; export * from './_applicationCommands/contextMenu'; @@ -107,22 +105,6 @@ export type APIApplicationCommandInteractionData = | APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData; -/** - * https://discord.com/developers/docs/resources/channel#channel-object - */ -export interface APIInteractionDataResolvedChannel extends Required { - thread_metadata?: APIThreadMetadata | null; - permissions: Permissions; - parent_id?: string | null; -} - -/** - * https://discord.com/developers/docs/resources/guild#guild-member-object - */ -export interface APIInteractionDataResolvedGuildMember extends Omit { - permissions: Permissions; -} - /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ diff --git a/payloads/v10/_interactions/base.ts b/payloads/v10/_interactions/base.ts index 130004b0..79164ef7 100644 --- a/payloads/v10/_interactions/base.ts +++ b/payloads/v10/_interactions/base.ts @@ -1,7 +1,7 @@ import type { InteractionType } from './responses'; import type { Permissions, Snowflake } from '../../../globals'; -import type { LocaleString } from '../../../v10'; -import type { APIMessage } from '../channel'; +import type { APIRole, LocaleString } from '../../../v10'; +import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel'; import type { APIGuildMember } from '../guild'; import type { APIUser } from '../user'; @@ -129,3 +129,46 @@ export type APIGuildInteractionWrapper & Required>; + +/** + * https://discord.com/developers/docs/resources/channel#channel-object + */ +export interface APIInteractionDataResolvedChannel extends Required { + thread_metadata?: APIThreadMetadata | null; + permissions: Permissions; + parent_id?: string | null; +} + +/** + * https://discord.com/developers/docs/resources/guild#guild-member-object + */ +export interface APIInteractionDataResolvedGuildMember extends Omit { + permissions: Permissions; +} + +/** + * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure + */ +export interface APIInteractionDataResolved { + users?: Record; + roles?: Record; + members?: Record; + channels?: Record; + attachments?: Record; +} + +/** + * @deprecated Renamed to `APIInteractionDataResolved` + */ +export type APIChatInputApplicationCommandInteractionDataResolved = APIInteractionDataResolved; + +/** + * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects + */ +export type APIUserInteractionDataResolved = Required> & + Pick; + +/** + * @deprecated Renamed to `APIUserInteractionDataResolved` + */ +export type APIUserApplicationCommandInteractionDataResolved = APIUserInteractionDataResolved; diff --git a/payloads/v10/_interactions/messageComponents.ts b/payloads/v10/_interactions/messageComponents.ts index 5775ce6b..e6650f4c 100644 --- a/payloads/v10/_interactions/messageComponents.ts +++ b/payloads/v10/_interactions/messageComponents.ts @@ -1,4 +1,10 @@ -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base'; +import type { + APIDMInteractionWrapper, + APIGuildInteractionWrapper, + APIInteractionDataResolved, + APIUserInteractionDataResolved, +} from './base'; +import type { Snowflake } from '../../../globals'; import type { ComponentType } from '../channel'; import type { APIBaseInteraction, InteractionType } from '../interactions'; @@ -50,11 +56,42 @@ export interface APIMessageComponentBaseInteractionData; -export interface APIMessageSelectMenuInteractionData - extends APIMessageComponentBaseInteractionData { +export interface APIMessageStringSelectInteractionData + extends APIMessageComponentBaseInteractionData { values: string[]; } +export interface APIMessageUserSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: APIUserInteractionDataResolved; +} + +export interface APIMessageRoleSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export interface APIMessageMentionableSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Pick; +} + +export interface APIMessageChannelSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export type APIMessageSelectMenuInteractionData = + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData + | APIMessageRoleSelectInteractionData + | APIMessageMentionableSelectInteractionData + | APIMessageChannelSelectInteractionData; + export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper; diff --git a/payloads/v10/channel.ts b/payloads/v10/channel.ts index 7cc5e236..2d3e2b04 100644 --- a/payloads/v10/channel.ts +++ b/payloads/v10/channel.ts @@ -1313,13 +1313,38 @@ export enum ComponentType { */ Button, /** - * Select Menu component + * Select menu for picking from defined text options */ - SelectMenu, + StringSelect, /** * Text Input component */ TextInput, + /** + * Select menu for users + */ + UserSelect, + /** + * Select menu for roles + */ + RoleSelect, + /** + * Select menu for users and roles + */ + MentionableSelect, + /** + * Select menu for channels + */ + ChannelSelect, + + // EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS // + + /** + * Select menu for picking from defined text options + * + * @deprecated This is the old name for {@apilink ComponentType#StringSelect} + */ + SelectMenu = 3, } /** @@ -1411,15 +1436,18 @@ export enum TextInputStyle { /** * https://discord.com/developers/docs/interactions/message-components#select-menus */ -export interface APISelectMenuComponent extends APIBaseComponent { +export interface APIBaseSelectMenuComponent< + T extends + | ComponentType.StringSelect + | ComponentType.UserSelect + | ComponentType.RoleSelect + | ComponentType.MentionableSelect + | ComponentType.ChannelSelect, +> extends APIBaseComponent { /** * A developer-defined identifier for the select menu, max 100 characters */ custom_id: string; - /** - * The choices in the select, max 25 - */ - options: APISelectMenuOption[]; /** * Custom placeholder text if nothing is selected, max 150 characters */ @@ -1444,6 +1472,51 @@ export interface APISelectMenuComponent extends APIBaseComponent { + /** + * Specified choices in a select menu; max 25 + */ + options: APISelectMenuOption[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIUserSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIRoleSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIMentionableSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export interface APIChannelSelectComponent extends APIBaseSelectMenuComponent { + /** + * List of channel types to include in the ChannelSelect component + */ + channel_types?: ChannelType[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APISelectMenuComponent = + | APIStringSelectComponent + | APIUserSelectComponent + | APIRoleSelectComponent + | APIMentionableSelectComponent + | APIChannelSelectComponent; + /** * https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */ diff --git a/payloads/v9/_interactions/_applicationCommands/chatInput.ts b/payloads/v9/_interactions/_applicationCommands/chatInput.ts index b1cddade..e0c34d7d 100644 --- a/payloads/v9/_interactions/_applicationCommands/chatInput.ts +++ b/payloads/v9/_interactions/_applicationCommands/chatInput.ts @@ -43,14 +43,8 @@ import type { APIApplicationCommandUserOption, } from './_chatInput/user'; import type { APIBaseApplicationCommandInteractionData } from './internals'; -import type { Snowflake } from '../../../../globals'; -import type { APIAttachment, APIRole, APIUser } from '../../index'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedChannel, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands'; +import type { APIInteractionDataResolved } from '../../index'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands'; import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base'; export * from './_chatInput/attachment'; @@ -114,18 +108,7 @@ export type APIApplicationCommandInteractionDataBasicOption = export interface APIChatInputApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { options?: APIApplicationCommandInteractionDataOption[]; - resolved?: APIChatInputApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIChatInputApplicationCommandInteractionDataResolved { - users?: Record; - roles?: Record; - members?: Record; - channels?: Record; - attachments?: Record; + resolved?: APIInteractionDataResolved; } /** diff --git a/payloads/v9/_interactions/_applicationCommands/contextMenu.ts b/payloads/v9/_interactions/_applicationCommands/contextMenu.ts index 5db54107..a56542eb 100644 --- a/payloads/v9/_interactions/_applicationCommands/contextMenu.ts +++ b/payloads/v9/_interactions/_applicationCommands/contextMenu.ts @@ -1,13 +1,8 @@ import type { APIBaseApplicationCommandInteractionData } from './internals'; import type { Snowflake } from '../../../../globals'; import type { APIMessage } from '../../channel'; -import type { APIUser } from '../../user'; -import type { - APIApplicationCommandInteractionWrapper, - APIInteractionDataResolvedGuildMember, - ApplicationCommandType, -} from '../applicationCommands'; -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base'; +import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands'; +import type { APIDMInteractionWrapper, APIGuildInteractionWrapper, APIUserInteractionDataResolved } from '../base'; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data @@ -15,15 +10,7 @@ import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../bas export interface APIUserApplicationCommandInteractionData extends APIBaseApplicationCommandInteractionData { target_id: Snowflake; - resolved: APIUserApplicationCommandInteractionDataResolved; -} - -/** - * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure - */ -export interface APIUserApplicationCommandInteractionDataResolved { - users: Record; - members?: Record; + resolved: APIUserInteractionDataResolved; } /** diff --git a/payloads/v9/_interactions/applicationCommands.ts b/payloads/v9/_interactions/applicationCommands.ts index 8f493391..fa4f01e9 100644 --- a/payloads/v9/_interactions/applicationCommands.ts +++ b/payloads/v9/_interactions/applicationCommands.ts @@ -15,8 +15,6 @@ import type { APIBaseInteraction } from './base'; import type { InteractionType } from './responses'; import type { Permissions, Snowflake } from '../../../globals'; import type { LocalizationMap } from '../../../v9'; -import type { APIPartialChannel, APIThreadMetadata } from '../channel'; -import type { APIGuildMember } from '../guild'; export * from './_applicationCommands/chatInput'; export * from './_applicationCommands/contextMenu'; @@ -107,22 +105,6 @@ export type APIApplicationCommandInteractionData = | APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData; -/** - * https://discord.com/developers/docs/resources/channel#channel-object - */ -export interface APIInteractionDataResolvedChannel extends Required { - thread_metadata?: APIThreadMetadata | null; - permissions: Permissions; - parent_id?: string | null; -} - -/** - * https://discord.com/developers/docs/resources/guild#guild-member-object - */ -export interface APIInteractionDataResolvedGuildMember extends Omit { - permissions: Permissions; -} - /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ diff --git a/payloads/v9/_interactions/base.ts b/payloads/v9/_interactions/base.ts index 3c49c20a..3b1a0a7d 100644 --- a/payloads/v9/_interactions/base.ts +++ b/payloads/v9/_interactions/base.ts @@ -1,7 +1,7 @@ import type { InteractionType } from './responses'; import type { Permissions, Snowflake } from '../../../globals'; -import type { LocaleString } from '../../../v9'; -import type { APIMessage } from '../channel'; +import type { APIRole, LocaleString } from '../../../v9'; +import type { APIAttachment, APIMessage, APIPartialChannel, APIThreadMetadata } from '../channel'; import type { APIGuildMember } from '../guild'; import type { APIUser } from '../user'; @@ -129,3 +129,46 @@ export type APIGuildInteractionWrapper & Required>; + +/** + * https://discord.com/developers/docs/resources/channel#channel-object + */ +export interface APIInteractionDataResolvedChannel extends Required { + thread_metadata?: APIThreadMetadata | null; + permissions: Permissions; + parent_id?: string | null; +} + +/** + * https://discord.com/developers/docs/resources/guild#guild-member-object + */ +export interface APIInteractionDataResolvedGuildMember extends Omit { + permissions: Permissions; +} + +/** + * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure + */ +export interface APIInteractionDataResolved { + users?: Record; + roles?: Record; + members?: Record; + channels?: Record; + attachments?: Record; +} + +/** + * @deprecated Renamed to `APIInteractionDataResolved` + */ +export type APIChatInputApplicationCommandInteractionDataResolved = APIInteractionDataResolved; + +/** + * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects + */ +export type APIUserInteractionDataResolved = Required> & + Pick; + +/** + * @deprecated Renamed to `APIUserInteractionDataResolved` + */ +export type APIUserApplicationCommandInteractionDataResolved = APIUserInteractionDataResolved; diff --git a/payloads/v9/_interactions/messageComponents.ts b/payloads/v9/_interactions/messageComponents.ts index 5775ce6b..e6650f4c 100644 --- a/payloads/v9/_interactions/messageComponents.ts +++ b/payloads/v9/_interactions/messageComponents.ts @@ -1,4 +1,10 @@ -import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base'; +import type { + APIDMInteractionWrapper, + APIGuildInteractionWrapper, + APIInteractionDataResolved, + APIUserInteractionDataResolved, +} from './base'; +import type { Snowflake } from '../../../globals'; import type { ComponentType } from '../channel'; import type { APIBaseInteraction, InteractionType } from '../interactions'; @@ -50,11 +56,42 @@ export interface APIMessageComponentBaseInteractionData; -export interface APIMessageSelectMenuInteractionData - extends APIMessageComponentBaseInteractionData { +export interface APIMessageStringSelectInteractionData + extends APIMessageComponentBaseInteractionData { values: string[]; } +export interface APIMessageUserSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: APIUserInteractionDataResolved; +} + +export interface APIMessageRoleSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export interface APIMessageMentionableSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Pick; +} + +export interface APIMessageChannelSelectInteractionData + extends APIMessageComponentBaseInteractionData { + values: Snowflake[]; + resolved: Required>; +} + +export type APIMessageSelectMenuInteractionData = + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData + | APIMessageRoleSelectInteractionData + | APIMessageMentionableSelectInteractionData + | APIMessageChannelSelectInteractionData; + export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; export type APIMessageComponentGuildInteraction = APIGuildInteractionWrapper; diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index 17eaab22..5df7c19b 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -1312,13 +1312,38 @@ export enum ComponentType { */ Button, /** - * Select Menu component + * Select menu for picking from defined text options */ - SelectMenu, + StringSelect, /** * Text Input component */ TextInput, + /** + * Select menu for users + */ + UserSelect, + /** + * Select menu for roles + */ + RoleSelect, + /** + * Select menu for users and roles + */ + MentionableSelect, + /** + * Select menu for channels + */ + ChannelSelect, + + // EVERYTHING BELOW THIS LINE SHOULD BE OLD NAMES FOR RENAMED ENUM MEMBERS // + + /** + * Select menu for picking from defined text options + * + * @deprecated This is the old name for {@apilink ComponentType#StringSelect} + */ + SelectMenu = 3, } /** @@ -1410,15 +1435,18 @@ export enum TextInputStyle { /** * https://discord.com/developers/docs/interactions/message-components#select-menus */ -export interface APISelectMenuComponent extends APIBaseComponent { +export interface APIBaseSelectMenuComponent< + T extends + | ComponentType.StringSelect + | ComponentType.UserSelect + | ComponentType.RoleSelect + | ComponentType.MentionableSelect + | ComponentType.ChannelSelect, +> extends APIBaseComponent { /** * A developer-defined identifier for the select menu, max 100 characters */ custom_id: string; - /** - * The choices in the select, max 25 - */ - options: APISelectMenuOption[]; /** * Custom placeholder text if nothing is selected, max 150 characters */ @@ -1443,6 +1471,51 @@ export interface APISelectMenuComponent extends APIBaseComponent { + /** + * Specified choices in a select menu; max 25 + */ + options: APISelectMenuOption[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIUserSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIRoleSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APIMentionableSelectComponent = APIBaseSelectMenuComponent; + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export interface APIChannelSelectComponent extends APIBaseSelectMenuComponent { + /** + * List of channel types to include in the ChannelSelect component + */ + channel_types?: ChannelType[]; +} + +/** + * https://discord.com/developers/docs/interactions/message-components#select-menus + */ +export type APISelectMenuComponent = + | APIStringSelectComponent + | APIUserSelectComponent + | APIRoleSelectComponent + | APIMentionableSelectComponent + | APIChannelSelectComponent; + /** * https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-option-structure */ diff --git a/tests/v10/interactions.test-d.ts b/tests/v10/interactions.test-d.ts index dfa97b0e..65fac64a 100644 --- a/tests/v10/interactions.test-d.ts +++ b/tests/v10/interactions.test-d.ts @@ -34,7 +34,7 @@ if (interaction.type === InteractionType.MessageComponent) { // expectType(data); } - if (data.component_type === ComponentType.SelectMenu) { + if (data.component_type === ComponentType.StringSelect) { // TODO: for some reason, tsd yields a `Parameter type APIMessageSelectMenuInteractionData is not identical to argument type APIMessageSelectMenuInteractionData.` error // expectType(data); expectType(data.values); diff --git a/utils/v10.ts b/utils/v10.ts index ee9fd305..cb257cc6 100644 --- a/utils/v10.ts +++ b/utils/v10.ts @@ -141,7 +141,13 @@ export function isMessageComponentButtonInteraction( export function isMessageComponentSelectMenuInteraction( interaction: APIMessageComponentInteraction, ): interaction is APIMessageComponentSelectMenuInteraction { - return interaction.data.component_type === ComponentType.SelectMenu; + return [ + ComponentType.StringSelect, + ComponentType.UserSelect, + ComponentType.RoleSelect, + ComponentType.MentionableSelect, + ComponentType.ChannelSelect, + ].includes(interaction.data.component_type); } // Application Commands diff --git a/utils/v9.ts b/utils/v9.ts index 21f0ba0b..cc340dfe 100644 --- a/utils/v9.ts +++ b/utils/v9.ts @@ -141,7 +141,13 @@ export function isMessageComponentButtonInteraction( export function isMessageComponentSelectMenuInteraction( interaction: APIMessageComponentInteraction, ): interaction is APIMessageComponentSelectMenuInteraction { - return interaction.data.component_type === ComponentType.SelectMenu; + return [ + ComponentType.StringSelect, + ComponentType.UserSelect, + ComponentType.RoleSelect, + ComponentType.MentionableSelect, + ComponentType.ChannelSelect, + ].includes(interaction.data.component_type); } // Application Commands