diff --git a/docs/resources/Message.md b/docs/resources/Message.md index 919bc42cc9..4681808d91 100644 --- a/docs/resources/Message.md +++ b/docs/resources/Message.md @@ -16,44 +16,44 @@ Represents a message sent in a channel within Discord. > warn > An app will receive empty values in the `content`, `embeds`, `attachments`, and `components` fields while `poll` will be omitted if they have not configured (or been approved for) the [`MESSAGE_CONTENT` privileged intent (`1 << 15`)](#DOCS_EVENTS_GATEWAY/message-content-intent). -| Field | Type | Description | -|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | id of the message | -| channel_id | snowflake | id of the channel the message was sent in | -| author \[1\] | [user](#DOCS_RESOURCES_USER/user-object) object | the author of this message (not guaranteed to be a valid user, see below) | -| content \[2\] | string | contents of the message | -| timestamp | ISO8601 timestamp | when this message was sent | -| edited_timestamp | ?ISO8601 timestamp | when this message was edited (or null if never) | -| tts | boolean | whether this was a TTS message | -| mention_everyone | boolean | whether this message mentions everyone | -| mentions | array of [user](#DOCS_RESOURCES_USER/user-object) objects | users specifically mentioned in the message | -| mention_roles | array of [role](#DOCS_TOPICS_PERMISSIONS/role-object) object ids | roles specifically mentioned in this message | -| mention_channels? \[3\] | array of [channel mention](#DOCS_RESOURCES_MESSAGE/channel-mention-object) objects | channels specifically mentioned in this message | -| attachments \[2\] | array of [attachment](#DOCS_RESOURCES_MESSAGE/attachment-object) objects | any attached files | -| embeds \[2\] | array of [embed](#DOCS_RESOURCES_MESSAGE/embed-object) objects | any embedded content | -| reactions? | array of [reaction](#DOCS_RESOURCES_MESSAGE/reaction-object) objects | reactions to the message | -| nonce? | integer or string | used for validating a message was sent | -| pinned | boolean | whether this message is pinned | -| webhook_id? | snowflake | if the message is generated by a webhook, this is the webhook's id | -| type | integer | [type of message](#DOCS_RESOURCES_MESSAGE/message-object-message-types) | -| activity? | [message activity](#DOCS_RESOURCES_MESSAGE/message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | -| application? | partial [application](#DOCS_RESOURCES_APPLICATION/application-object) object | sent with Rich Presence-related chat embeds | -| application_id? | snowflake | if the message is an [Interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) or application-owned webhook, this is the id of the application | -| flags? | integer | [message flags](#DOCS_RESOURCES_MESSAGE/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| message_reference? | [message reference](#DOCS_RESOURCES_MESSAGE/message-reference-structure) object | data showing the source of a crosspost, channel follow add, pin, or reply message | -| message_snapshots? \[5\] | array of [message snapshot](#DOCS_RESOURCES_MESSAGE/message-snapshot-object) objects | the message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.) | -| referenced_message? \[4\] | ?[message object](#DOCS_RESOURCES_MESSAGE/message-object) | the message associated with the message_reference | -| interaction_metadata? | [message interaction metadata object](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-message-interaction-metadata-structure) | [In preview](#DOCS_CHANGE_LOG/user-installable-apps-preview). Sent if the message is sent as a result of an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | -| interaction? | [message interaction object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/message-interaction-object-message-interaction-structure) | **Deprecated in favor of `interaction_metadata`**; sent if the message is a response to an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | -| thread? | [channel](#DOCS_RESOURCES_CHANNEL/channel-object) object | the thread that was started from this message, includes [thread member](#DOCS_RESOURCES_CHANNEL/thread-member-object) object | -| components? \[2\] | array of [message components](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object) | sent if the message contains components like buttons, action rows, or other interactive components | -| sticker_items? | array of [message sticker item objects](#DOCS_RESOURCES_STICKER/sticker-item-object) | sent if the message contains stickers | -| stickers? | array of [sticker](#DOCS_RESOURCES_STICKER/sticker-object) objects | **Deprecated** the stickers sent with the message | -| position? | integer | A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread | -| role_subscription_data? | [role subscription data](#DOCS_RESOURCES_MESSAGE/role-subscription-data-object) object | data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message | -| resolved? | [resolved](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-resolved-data-structure) data | data for users, members, channels, and roles in the message's [auto-populated select menus](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menus) | -| poll? \[2\] | [poll](#DOCS_RESOURCES_POLL/poll-object) object | A poll! | -| call? | [message call](#DOCS_RESOURCES_MESSAGE/message-call-object) object | the call associated with the message | +| Field | Type | Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | id of the message | +| channel_id | snowflake | id of the channel the message was sent in | +| author \[1\] | [user](#DOCS_RESOURCES_USER/user-object) object | the author of this message (not guaranteed to be a valid user, see below) | +| content \[2\] | string | contents of the message | +| timestamp | ISO8601 timestamp | when this message was sent | +| edited_timestamp | ?ISO8601 timestamp | when this message was edited (or null if never) | +| tts | boolean | whether this was a TTS message | +| mention_everyone | boolean | whether this message mentions everyone | +| mentions | array of [user](#DOCS_RESOURCES_USER/user-object) objects | users specifically mentioned in the message | +| mention_roles | array of [role](#DOCS_TOPICS_PERMISSIONS/role-object) object ids | roles specifically mentioned in this message | +| mention_channels? \[3\] | array of [channel mention](#DOCS_RESOURCES_MESSAGE/channel-mention-object) objects | channels specifically mentioned in this message | +| attachments \[2\] | array of [attachment](#DOCS_RESOURCES_MESSAGE/attachment-object) objects | any attached files | +| embeds \[2\] | array of [embed](#DOCS_RESOURCES_MESSAGE/embed-object) objects | any embedded content | +| reactions? | array of [reaction](#DOCS_RESOURCES_MESSAGE/reaction-object) objects | reactions to the message | +| nonce? | integer or string | used for validating a message was sent | +| pinned | boolean | whether this message is pinned | +| webhook_id? | snowflake | if the message is generated by a webhook, this is the webhook's id | +| type | integer | [type of message](#DOCS_RESOURCES_MESSAGE/message-object-message-types) | +| activity? | [message activity](#DOCS_RESOURCES_MESSAGE/message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | +| application? | partial [application](#DOCS_RESOURCES_APPLICATION/application-object) object | sent with Rich Presence-related chat embeds | +| application_id? | snowflake | if the message is an [Interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) or application-owned webhook, this is the id of the application | +| flags? | integer | [message flags](#DOCS_RESOURCES_MESSAGE/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| message_reference? | [message reference](#DOCS_RESOURCES_MESSAGE/message-reference-structure) object | data showing the source of a crosspost, channel follow add, pin, or reply message | +| message_snapshots? \[5\] | array of [message snapshot](#DOCS_RESOURCES_MESSAGE/message-snapshot-object) objects | the message associated with the `message_reference`. This is a minimal subset of fields in a message (e.g. `author` is excluded.) | +| referenced_message? \[4\] | ?[message object](#DOCS_RESOURCES_MESSAGE/message-object) | the message associated with the message_reference | +| interaction_metadata? | [message interaction metadata object](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object) | [In preview](#DOCS_CHANGE_LOG/user-installable-apps-preview). Sent if the message is sent as a result of an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | +| interaction? | [message interaction object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/message-interaction-object-message-interaction-structure) | **Deprecated in favor of `interaction_metadata`**; sent if the message is a response to an [interaction](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | +| thread? | [channel](#DOCS_RESOURCES_CHANNEL/channel-object) object | the thread that was started from this message, includes [thread member](#DOCS_RESOURCES_CHANNEL/thread-member-object) object | +| components? \[2\] | array of [message components](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object) | sent if the message contains components like buttons, action rows, or other interactive components | +| sticker_items? | array of [message sticker item objects](#DOCS_RESOURCES_STICKER/sticker-item-object) | sent if the message contains stickers | +| stickers? | array of [sticker](#DOCS_RESOURCES_STICKER/sticker-object) objects | **Deprecated** the stickers sent with the message | +| position? | integer | A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread | +| role_subscription_data? | [role subscription data](#DOCS_RESOURCES_MESSAGE/role-subscription-data-object) object | data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message | +| resolved? | [resolved](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-resolved-data-structure) data | data for users, members, channels, and roles in the message's [auto-populated select menus](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menus) | +| poll? \[2\] | [poll](#DOCS_RESOURCES_POLL/poll-object) object | A poll! | +| call? | [message call](#DOCS_RESOURCES_MESSAGE/message-call-object) object | the call associated with the message | \[1\] The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the `webhook_id` on the message object. @@ -61,7 +61,7 @@ Represents a message sent in a channel within Discord. \[3\] Not all channel mentions in a message will appear in `mention_channels`. Only textual channels that are visible to everyone in a lurkable guild will ever be included. Only crossposted messages (via Channel Following) currently include `mention_channels` at all. If no mentions in the message meet these requirements, this field will not be sent. -\[4\] This field is only returned for messages with a `type` of `19` (REPLY) or `21` (THREAD_STARTER_MESSAGE). If the message is a reply but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted. +\[4\] This field is only returned for messages with a `type` of `19` (REPLY), `21` (THREAD_STARTER_MESSAGE), or `23` (CONTEXT_MENU_COMMAND). If the message is one of these but the `referenced_message` field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted. \[5\] See [message reference types](#DOCS_RESOURCES_MESSAGE/message-reference-types) @@ -247,17 +247,44 @@ Represents a message sent in a channel within Discord. Metadata about the interaction, including the source of the interaction and relevant server and user IDs. -###### Message Interaction Metadata Structure +One of [Application Command Interaction Metadata](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-application-command-interaction-metadata-structure), [Message Component Interaction Metadata](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-message-component-interaction-metadata-structure), or [Modal Submit Interaction Metadata](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-modal-submit-interaction-metadata-structure). + +###### Application Command Interaction Metadata Structure + +| Field | Type | Description | +|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-type) | Type of interaction | +| user | [user](#DOCS_RESOURCES_USER/user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](#DOCS_RESOURCES_APPLICATION/application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | +| target_user? | [user](#DOCS_RESOURCES_USER/user-object) object | The user the command was run on, present only on [user command](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/user-commands) interactions | +| target_message_id? | snowflake | The ID of the message the command was run on, present only on [message command](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/message-commands) interactions. The original response message will also have `message_reference` and `referenced_message` pointing to this message. | + + +###### Message Component Interaction Metadata Structure + +| Field | Type | Description | +|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-type) | Type of interaction | +| user | [user](#DOCS_RESOURCES_USER/user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](#DOCS_RESOURCES_APPLICATION/application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | +| interacted_message_id | snowflake | ID of the message that contained the interactive component | + + +###### Modal Submit Interaction Metadata Structure + +| Field | Type | Description | +|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | ID of the interaction | +| type | [interaction type](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-type) | Type of interaction | +| user | [user](#DOCS_RESOURCES_USER/user-object) object | User who triggered the interaction | +| authorizing_integration_owners | dictionary with keys of [application integration types](#DOCS_RESOURCES_APPLICATION/application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-authorizing-integration-owners-object) | +| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | +| triggering_interaction_metadata | [Application Command Interaction Metadata](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-application-command-interaction-metadata-structure) or [Message Component Interaction Metadata](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-message-component-interaction-metadata-structure) object | Metadata for the interaction that was used to open the modal | -| Field | Type | Description | -|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | ID of the interaction | -| type | [interaction type](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-interaction-type) | Type of interaction | -| user | [user object](#DOCS_RESOURCES_USER/user-object) | User who triggered the interaction | -| authorizing_integration_owners | dictionary with keys of [application integration types](#DOCS_RESOURCES_APPLICATION/application-object-application-integration-types) | IDs for installation context(s) related to an interaction. Details in [Authorizing Integration Owners Object](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-authorizing-integration-owners-object) | -| original_response_message_id? | snowflake | ID of the original response message, present only on [follow-up messages](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/) | -| interacted_message_id? | snowflake | ID of the message that contained interactive component, present only on messages created from component interactions | -| triggering_interaction_metadata? | Message Interaction Metadata Structure | Metadata for the interaction that was used to open the modal, present only on modal submit interactions | ### Message Call Object @@ -338,6 +365,7 @@ There are multiple message types that have a `message_reference` object. - These are messages replying to a previous message (type 19). - These messages have `message_id` and `channel_id`, and `guild_id` if it is in a guild, which point to the message that was replied to. The channel_id and guild_id will be the same as the reply. - Replies are created by including a message_reference when sending a message. When sending, only `message_id` is required. +- These messages can have the referenced message resolved in the `referenced_message` field. ###### Thread Created messages @@ -348,6 +376,7 @@ There are multiple message types that have a `message_reference` object. - These are the first message in public threads created from messages. They point back to the message in the parent channel from which the thread was started. (type 21) - These messages have `message_id`, `channel_id`, and `guild_id`. +- These messages can have the referenced message resolved in the `referenced_message` field. - These messages will never have content, embeds, or attachments, mainly just the `message_reference` and `referenced_message` fields. ###### Poll result messages @@ -357,6 +386,12 @@ There are multiple message types that have a `message_reference` object. - The author will be the same as the author of the poll and will be mentioned. - These messages contain a [`poll_result` embed](#DOCS_RESOURCES_MESSAGE/embed-fields-by-embed-type-poll-result-embed-fields) +###### Context Menu Command messages + +- These are messages sent when a user uses a context menu Application Command. (type 23) +- If the command was a [message command](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/message-commands), the message will have have `message_id` and `channel_id`, and `guild_id` if it is in a guild, which point to the message that the command was used on. The channel_id and guild_id will be the same as the new message. +- These messages can have the referenced message resolved in the `referenced_message` field. + #### Voice Messages Voice messages are messages with the `IS_VOICE_MESSAGE` flag. They have the following properties. diff --git a/docs/tutorials/Developing_a_User_Installable_App.mdx b/docs/tutorials/Developing_a_User_Installable_App.mdx index 9c5c9f07f8..0b6bb3d822 100644 --- a/docs/tutorials/Developing_a_User_Installable_App.mdx +++ b/docs/tutorials/Developing_a_User_Installable_App.mdx @@ -355,7 +355,7 @@ There are two fields additional fields to know about that can be helpful in this ###### `interaction_metadata` -Messages created in response to an interaction will include an [`interaction_metadata` object](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object-message-interaction-metadata-structure) which includes metadata related to the interaction. +Messages created in response to an interaction will include an [`interaction_metadata` object](#DOCS_RESOURCES_MESSAGE/message-interaction-metadata-object) which includes metadata related to the interaction. ###### `authorizing_integration_owners`