Skip to main content

Interaction

Documentation


Documentation / @discordeno/bot / Interaction

Interface: Interaction

Defined in: bot/src/transformers/types.ts:889

Properties

acknowledged

acknowledged: boolean

Defined in: bot/src/transformers/types.ts:893

Whether or not this interaction has been responded to.


applicationId

applicationId: bigint

Defined in: bot/src/transformers/types.ts:897

Id of the application this interaction is for


appPermissions

appPermissions: bigint

Defined in: bot/src/transformers/types.ts:931

The computed permissions for a bot or app in the context of a specific interaction (including channel overwrites)


attachmentSizeLimit

attachmentSizeLimit: number

Defined in: bot/src/transformers/types.ts:937

Attachment size limit in bytes


authorizingIntegrationOwners

authorizingIntegrationOwners: Partial<Record<DiscordApplicationIntegrationType, bigint>>

Defined in: bot/src/transformers/types.ts:933

Mapping of installation contexts that the interaction was authorized for to related user or guild IDs.


bot

bot: Bot

Defined in: bot/src/transformers/types.ts:891

The bot object


channel

channel: Partial<Channel>

Defined in: bot/src/transformers/types.ts:905

The channel it was sent from


channelId?

optional channelId: bigint

Defined in: bot/src/transformers/types.ts:912

The ID of channel it was sent from

Remarks

It is recommended that you begin using this channel field to identify the source channel of the interaction as they may deprecate the existing channel_id field in the future.


context?

optional context: DiscordInteractionContextType

Defined in: bot/src/transformers/types.ts:935

Context where the interaction was triggered from


data?

optional data: InteractionData

Defined in: bot/src/transformers/types.ts:924

the command data payload


defer()

defer: (isPrivate?, options?) => Promise<void | InteractionCallbackResponse>

Defined in: bot/src/transformers/types.ts:974

Defer the interaction for updating the response at a later time with edit.

Parameters

isPrivate?

boolean

options?

InteractionCallbackOptions

Returns

Promise<void | InteractionCallbackResponse>

Remarks

This will send a DeferredChannelMessageWithSource response.


deferEdit()

deferEdit: (options?) => Promise<void | InteractionCallbackResponse>

Defined in: bot/src/transformers/types.ts:967

Defer the interaction for updating the referenced message at a later time with edit.

Parameters

options?

InteractionCallbackOptions

Returns

Promise<void | InteractionCallbackResponse>

Remarks

This will send a DeferredUpdateMessage response.


delete()

delete: (messageId?) => Promise<void>

Defined in: bot/src/transformers/types.ts:976

Delete the original interaction response or a followup if the message id is provided.

Parameters

messageId?

BigString

Returns

Promise<void>


edit()

edit: (response, messageId?, options?) => Promise<void | InteractionCallbackResponse | Message>

Defined in: bot/src/transformers/types.ts:956

Edit the original response of an interaction or a followup if the message id is provided.

Parameters

response

string | InteractionCallbackData

messageId?

BigString

options?

InteractionCallbackOptions

Returns

Promise<void | InteractionCallbackResponse | Message>

Remarks

This will edit the original interaction response or, if the interaction has not yet been acknowledged and the type of the interaction is MessageComponent it will instead send a UpdateMessage response instead.


entitlements

entitlements: Entitlement[]

Defined in: bot/src/transformers/types.ts:929

For monetized apps, any entitlements for the invoking user, representing access to premium SKUs


guild

guild: Guild

Defined in: bot/src/transformers/types.ts:901

Guild that the interaction was sent from


guildId?

optional guildId: bigint

Defined in: bot/src/transformers/types.ts:903

The guild it was sent from


guildLocale?

optional guildLocale: string

Defined in: bot/src/transformers/types.ts:927

The guild's preferred locale, if invoked in a guild


id

id: bigint

Defined in: bot/src/transformers/types.ts:895

Id of the interaction


locale?

optional locale: string

Defined in: bot/src/transformers/types.ts:925


member?

optional member: Member

Defined in: bot/src/transformers/types.ts:914

Guild member data for the invoking user, including permissions


message?

optional message: Message

Defined in: bot/src/transformers/types.ts:922

For components or modals triggered by components, the message they were attached to


respond()

respond: (response, options?) => Promise<void | InteractionCallbackResponse | Message>

Defined in: bot/src/transformers/types.ts:946

Sends a response to an interaction.

Parameters

response

string | InteractionCallbackData

options?
isPrivate?

boolean

withResponse?

boolean

Returns

Promise<void | InteractionCallbackResponse | Message>

Remarks

This will send a ChannelMessageWithSource, ApplicationCommandAutocompleteResult or Modal response based on the type of the interaction you are responding to.

If the interaction has been already acknowledged, indicated by Interaction.acknowledged, it will send a followup message instead.


token

token: string

Defined in: bot/src/transformers/types.ts:918

A continuation token for responding to the interaction


type

type: InteractionTypes

Defined in: bot/src/transformers/types.ts:899

The type of interaction


user

user: User

Defined in: bot/src/transformers/types.ts:916

User object for the invoking user, if invoked in a DM


version

version: 1

Defined in: bot/src/transformers/types.ts:920

Read-only property, always 1