diff --git a/docs/Change_Log.md b/docs/Change_Log.md index 904a533546..474220703c 100644 --- a/docs/Change_Log.md +++ b/docs/Change_Log.md @@ -1,5 +1,17 @@ # Change Log +## Inline Replies + +#### November 16, 2020 + +Inline Replies have been added to our documentation. They behave differently in v6 and v8, so be cautious in your implementation: + +- Inline replies are type `19` in v8, but remain type `0` in v6 +- You can now add a `message_reference` on message create to create a reply +- A new field `referenced_message` has been added to the [Message Object](#DOCS_RESOURCES_CHANNEL/message-object) +- A new field `replied_user` has been added to the [Allowed Mentions Object](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object) +- [Message Create](#DOCS_TOPICS_GATEWAY/message-create) gateway event is guaranteed to have a `referenced_message` if the message created is a reply. Otherwise, that field is not guaranteed. + ## Stickers #### November 13, 2020 diff --git a/docs/resources/Channel.md b/docs/resources/Channel.md index fe84a777a0..9de64ea30a 100644 --- a/docs/resources/Channel.md +++ b/docs/resources/Channel.md @@ -176,33 +176,34 @@ Represents a message sent in a channel within Discord. ###### Message Structure -| Field | Type | Description | -|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| -| id | snowflake | id of the message | -| channel_id | snowflake | id of the channel the message was sent in | -| guild_id? | snowflake | id of the guild the message was sent in | -| author\* | [user](#DOCS_RESOURCES_USER/user-object) object | the author of this message (not guaranteed to be a valid user, see below) | -| member?\*\* | partial [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object | member properties for this message's author | -| content | 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, with an additional partial [member](#DOCS_RESOURCES_GUILD/guild-member-object) field | 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?\*\*\*\* | array of [channel mention](#DOCS_RESOURCES_CHANNEL/channel-mention-object) objects | channels specifically mentioned in this message | -| attachments | array of [attachment](#DOCS_RESOURCES_CHANNEL/attachment-object) objects | any attached files | -| embeds | array of [embed](#DOCS_RESOURCES_CHANNEL/embed-object) objects | any embedded content | -| reactions? | array of [reaction](#DOCS_RESOURCES_CHANNEL/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_CHANNEL/message-object-message-types) | -| activity? | [message activity](#DOCS_RESOURCES_CHANNEL/message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | -| application? | [message application](#DOCS_RESOURCES_CHANNEL/message-object-message-application-structure) object | sent with Rich Presence-related chat embeds | -| message_reference? | [message reference](#DOCS_RESOURCES_CHANNEL/message-object-message-reference-structure) object | reference data sent with crossposted messages | -| flags? | integer | [message flags](#DOCS_RESOURCES_CHANNEL/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | -| stickers? | array of [sticker](#DOCS_RESOURCE_CHANNEL/message-object-message-sticker-structure) objects | the stickers sent with the message (bots currently can only receive messages with stickers, not send) | +| Field | Type | Description | +|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------| +| id | snowflake | id of the message | +| channel_id | snowflake | id of the channel the message was sent in | +| guild_id? | snowflake | id of the guild the message was sent in | +| author\* | [user](#DOCS_RESOURCES_USER/user-object) object | the author of this message (not guaranteed to be a valid user, see below) | +| member?\*\* | partial [guild member](#DOCS_RESOURCES_GUILD/guild-member-object) object | member properties for this message's author | +| content | 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, with an additional partial [member](#DOCS_RESOURCES_GUILD/guild-member-object) field | 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?\*\*\*\* | array of [channel mention](#DOCS_RESOURCES_CHANNEL/channel-mention-object) objects | channels specifically mentioned in this message | +| attachments | array of [attachment](#DOCS_RESOURCES_CHANNEL/attachment-object) objects | any attached files | +| embeds | array of [embed](#DOCS_RESOURCES_CHANNEL/embed-object) objects | any embedded content | +| reactions? | array of [reaction](#DOCS_RESOURCES_CHANNEL/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_CHANNEL/message-object-message-types) | +| activity? | [message activity](#DOCS_RESOURCES_CHANNEL/message-object-message-activity-structure) object | sent with Rich Presence-related chat embeds | +| application? | [message application](#DOCS_RESOURCES_CHANNEL/message-object-message-application-structure) object | sent with Rich Presence-related chat embeds | +| message_reference? | [message reference](#DOCS_RESOURCES_CHANNEL/message-object-message-reference-structure) object | reference data sent with crossposted messages and replies | +| flags? | integer | [message flags](#DOCS_RESOURCES_CHANNEL/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) | +| stickers? | array of [sticker](#DOCS_RESOURCE_CHANNEL/message-object-message-sticker-structure) objects | the stickers sent with the message (bots currently can only receive messages with stickers, not send) | +| referenced_message?\*\*\*\*\* | ?[message object](#DOCS_RESOURCES_CHANNEL/message-object) | the message associated with the message_reference | \* 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. @@ -212,8 +213,13 @@ Represents a message sent in a channel within Discord. \*\*\*\* 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. +\*\*\*\*\* This field is only returned for messages with a `type` of `19` (REPLY). 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. + ###### Message Types +> warn +> Replies only have type `19` in API v8. In v6, they are still type `0`. + | Type | Value | |----------------------------------------|-------| | DEFAULT | 0 | @@ -231,6 +237,7 @@ Represents a message sent in a channel within Discord. | CHANNEL_FOLLOW_ADD | 12 | | GUILD_DISCOVERY_DISQUALIFIED | 14 | | GUILD_DISCOVERY_REQUALIFIED | 15 | +| REPLY | 19 | ###### Message Activity Structure @@ -549,11 +556,12 @@ The allowed mention field allows for more granular control over mentions without ###### Allowed Mentions Structure -| Field | Type | Description | -|-------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| -| parse | array of allowed mention types | An array of [allowed mention types](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object-allowed-mention-types) to parse from the content. | -| roles | list of snowflakes | Array of role_ids to mention (Max size of 100) | -| users | list of snowflakes | Array of user_ids to mention (Max size of 100) | +| Field | Type | Description | +|--------------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| +| parse | array of allowed mention types | An array of [allowed mention types](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object-allowed-mention-types) to parse from the content. | +| roles | list of snowflakes | Array of role_ids to mention (Max size of 100) | +| users | list of snowflakes | Array of user_ids to mention (Max size of 100) | +| replied_user | boolean | For replies, whether to mention the author of the message being replied to (default false) | ###### Allowed Mentions Reference @@ -726,6 +734,8 @@ This endpoint supports requests with `Content-Type`s of both `application/json` > info > Note that when sending `application/json` you must send at least one of `content` or `embed`, and when sending `multipart/form-data`, you must send at least one of `content`, `embed` or `file`. For a `file` attachment, the `Content-Disposition` subpart header MUST contain a `filename` parameter. +You may create a message as a reply to another message. To do so, include a [`message_reference`](#DOCS_RESOURCES_CHANNEL/message-object-message-reference-structure) with a `message_id`. This requires the `VIEW MESSAGE HISTORY` permission, and the referenced message must exist and cannot be a system message. The `channel_id` and `guild_id` in the `message_reference` are optional, but will be validated if provided. + ###### Params | Field | Type | Description | @@ -737,6 +747,7 @@ This endpoint supports requests with `Content-Type`s of both `application/json` | embed | [embed](#DOCS_RESOURCES_CHANNEL/embed-object) object | embedded `rich` content | | payload_json | string | JSON encoded body of any additional request fields. | | allowed_mentions | [allowed_mentions](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object) object | allowed mentions for a message | +| message_reference | [message reference](#DOCS_RESOURCES_CHANNEL/message-object-message-reference-structure) | include to make your message a reply | > info > For the embed object, you can set every field except `type` (it will be `rich` regardless of if you try to set it), `provider`, `video`, and any `height`, `width`, or `proxy_url` values for images.