Skip to content

Commit b701a20

Browse files
ypisetskyshaydewael
authored andcommitted
[message_create] Document new enforce_nonce param (discord#6647)
Recently I added a new enforce_nonce on POST channel/messages parameter that will allow bots to opt in to having their messages deduped on the nonce parameter in a short duration.
1 parent cf079c1 commit b701a20

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

docs/Change_Log.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## Enforced Nonces on Create Message Endpoint
4+
5+
#### February 12, 2024
6+
7+
The [Create message](#DOCS_RESOURCES_CHANNEL/create-message) endpoint now supports an `enforce_nonce` parameter. When set to true, the message will be deduped for the same sender within a few minutes. If a message was created with the same nonce, no new message will be created and the previous message will be returned instead. This behavior will become the default for this endpoint in a future API version.
8+
39
## Limit Number of Fields in Embeds
410

511
#### December 19, 2023

docs/resources/Channel.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,20 +1053,21 @@ Files must be attached using a `multipart/form-data` body as described in [Uploa
10531053
> info
10541054
> When creating a message, apps must provide a value for **at least one of** `content`, `embeds`, `sticker_ids`, `components`, or `files[n]`.
10551055
1056-
| Field | Type | Description |
1057-
|--------------------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1058-
| content?\* | string | Message contents (up to 2000 characters) |
1059-
| nonce? | integer or string | Can be used to verify a message was sent (up to 25 characters). Value will appear in the [Message Create event](#DOCS_TOPICS_GATEWAY_EVENTS/message-create). |
1060-
| tts? | boolean | `true` if this is a TTS message |
1061-
| embeds?\* | array of [embed](#DOCS_RESOURCES_CHANNEL/embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) |
1062-
| allowed_mentions? | [allowed mention object](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object) | Allowed mentions for the message |
1063-
| message_reference? | [message reference](#DOCS_RESOURCES_CHANNEL/message-reference-object-message-reference-structure) | Include to make your message a reply |
1064-
| components?\* | array of [message component](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object) objects | Components to include with the message |
1065-
| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](#DOCS_RESOURCES_STICKER/sticker-object) in the server to send in the message |
1066-
| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](#DOCS_REFERENCE/uploading-files) |
1067-
| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](#DOCS_REFERENCE/uploading-files) |
1068-
| attachments? | array of partial [attachment](#DOCS_RESOURCES_CHANNEL/attachment-object) objects | Attachment objects with filename and description. See [Uploading Files](#DOCS_REFERENCE/uploading-files) |
1069-
| flags? | integer | [Message flags](#DOCS_RESOURCES_CHANNEL/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS` and `SUPPRESS_NOTIFICATIONS` can be set) |
1056+
| Field | Type | Description |
1057+
|--------------------|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1058+
| content?\* | string | Message contents (up to 2000 characters) |
1059+
| nonce? | integer or string | Can be used to verify a message was sent (up to 25 characters). Value will appear in the [Message Create event](#DOCS_TOPICS_GATEWAY_EVENTS/message-create). |
1060+
| tts? | boolean | `true` if this is a TTS message |
1061+
| embeds?\* | array of [embed](#DOCS_RESOURCES_CHANNEL/embed-object) objects | Up to 10 `rich` embeds (up to 6000 characters) |
1062+
| allowed_mentions? | [allowed mention object](#DOCS_RESOURCES_CHANNEL/allowed-mentions-object) | Allowed mentions for the message |
1063+
| message_reference? | [message reference](#DOCS_RESOURCES_CHANNEL/message-reference-object-message-reference-structure) | Include to make your message a reply |
1064+
| components?\* | array of [message component](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object) objects | Components to include with the message |
1065+
| sticker_ids?\* | array of snowflakes | IDs of up to 3 [stickers](#DOCS_RESOURCES_STICKER/sticker-object) in the server to send in the message |
1066+
| files[n]?\* | file contents | Contents of the file being sent. See [Uploading Files](#DOCS_REFERENCE/uploading-files) |
1067+
| payload_json? | string | JSON-encoded body of non-file params, only for `multipart/form-data` requests. See [Uploading Files](#DOCS_REFERENCE/uploading-files) |
1068+
| attachments? | array of partial [attachment](#DOCS_RESOURCES_CHANNEL/attachment-object) objects | Attachment objects with filename and description. See [Uploading Files](#DOCS_REFERENCE/uploading-files |
1069+
| flags? | integer | [Message flags](#DOCS_RESOURCES_CHANNEL/message-object-message-flags) combined as a [bitfield](https://en.wikipedia.org/wiki/Bit_field) (only `SUPPRESS_EMBEDS` and `SUPPRESS_NOTIFICATIONS` can be set) |
1070+
| enforce_nonce? | boolean | If true and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce, that message will be returned and no new message will be created. |
10701071

10711072
\* At least one of `content`, `embeds`, `sticker_ids`, `components`, or `files[n]` is required.
10721073

0 commit comments

Comments
 (0)