import type { ChannelType, Permissions, Snowflake } from '../..'; import type { LocaleString } from '../../rest'; import type { ApplicationIntegrationType, InteractionContextType } from '..'; import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadChannel, ThreadChannelType } from '../channel'; import type { APIGuildMember, APIPartialInteractionGuild } from '../guild'; import type { APIEntitlement } from '../monetization'; import type { APIRole } from '../permissions'; import type { APIUser } from '../user'; import type { InteractionType } from './responses'; /** * https://discord.com/developers/docs/resources/channel#message-interaction-metadata-object */ export interface APIMessageInteractionMetadata { /** * ID of the interaction */ id: Snowflake; /** * Type of interaction */ type: InteractionType; /** * User who triggered the interaction */ user: APIUser; /** * IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */ authorizing_integration_owners: APIAuthorizingIntegrationOwnersMap; /** * ID of the original response message, present only on follow-up messages */ original_response_message_id?: Snowflake; /** * ID of the message that contained interactive component, present only on messages created from component interactions */ interacted_message_id?: Snowflake; /** * Metadata for the interaction that was used to open the modal, present only on modal submit interactions */ triggering_interaction_metadata?: APIMessageInteractionMetadata; } export type PartialAPIMessageInteractionGuildMember = Pick; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object */ export interface APIMessageInteraction { /** * ID of the interaction */ id: Snowflake; /** * The type of interaction */ type: InteractionType; /** * The name of the application command, including subcommands and subcommand groups */ name: string; /** * The user who invoked the interaction */ user: APIUser; /** * The guild member who invoked the interaction, only sent in MESSAGE_CREATE events */ member?: PartialAPIMessageInteractionGuildMember; } /** * https://discord.com/developers/docs/resources/guild#guild-member-object */ export interface APIInteractionGuildMember extends APIGuildMember { permissions: Permissions; user: APIUser; } /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export interface APIBaseInteraction { /** * ID of the interaction */ id: Snowflake; /** * ID of the application this interaction is for */ application_id: Snowflake; /** * The type of interaction */ type: Type; /** * The command data payload */ data?: Data; /** * The guild it was sent from */ guild?: APIPartialInteractionGuild; /** * The guild it was sent from */ guild_id?: Snowflake; /** * The channel it was sent from */ channel: Partial & Pick; /** * Guild member data for the invoking user, including permissions * * **This is only sent when an interaction is invoked in a guild** */ member?: APIInteractionGuildMember; /** * User object for the invoking user, if invoked in a DM */ user?: APIUser; /** * A continuation token for responding to the interaction */ token: string; /** * Read-only property, always `1` */ version: 1; /** * For components, the message they were attached to */ message?: APIMessage; /** * Bitwise set of permissions the app or bot has within the channel the interaction was sent from */ app_permissions: Permissions; /** * The selected language of the invoking user */ locale: LocaleString; /** * The guild's preferred locale, if invoked in a guild */ guild_locale?: LocaleString; /** * For monetized apps, any entitlements for the invoking user, representing access to premium SKUs */ entitlements: APIEntitlement[]; /** * Mapping of installation contexts that the interaction was authorized for to related user or guild IDs. */ authorizing_integration_owners: APIAuthorizingIntegrationOwnersMap; /** * Context where the interaction was triggered from */ context?: InteractionContextType; /** * Attachment size limit in bytes */ attachment_size_limit: number; } export type APIAuthorizingIntegrationOwnersMap = { [key in ApplicationIntegrationType]?: Snowflake; }; export type APIDMInteractionWrapper> = Omit & Required>; export type APIGuildInteractionWrapper> = Omit & Required>; export interface APIInteractionDataResolvedChannelBase extends Required { type: T; permissions: Permissions; } /** * https://discord.com/developers/docs/resources/channel#channel-object */ export type APIInteractionDataResolvedChannel = APIInteractionDataResolvedChannelBase> | (APIInteractionDataResolvedChannelBase & Pick); /** * 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; } /** * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects */ export type APIUserInteractionDataResolved = Pick & Required>;