feat(http): add enforce_nonce to CreateMessage - #2570
Open
thomas-quant wants to merge 1 commit into
Open
Conversation
Discord's create-message endpoint accepts an `enforce_nonce` boolean alongside `nonce`. When set, the nonce is checked for uniqueness against the author's recent messages and an existing match is returned instead of a second message being created. `nonce` is already supported here, but on its own it is only echoed back — the deduplication that makes a retried create idempotent requires `enforce_nonce`. Without it, a transient failure arriving after Discord accepted a message is indistinguishable from one arriving before, and the retry posts a duplicate. Mirrors the existing `tts` builder.
Member
|
Hi, Thank you for the pull request. The implementation looks good to me. Thank you also for the since-deleted LLM implementation disclaimer. This project does not currently have a defined policy on when, if at all, to accept LLM generated contributions. I've raised this pull request with the team. It may be placed on hold until such a policy is drafted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
enforce_noncetoCreateMessage, mirroring the existingttsbuilder.nonceis already supported, but alone it is only echoed back.enforce_nonceis what makes a repeated create idempotent: without it, a transient failure arriving after Discord accepted a message is indistinguishable from one arriving before, and the retry posts a duplicate.From Create Message → JSON/Form Params:
Verified against the live API on a bot token, including on the multipart attachment path: two creates sharing a nonce return one message and one
attachments[0].id, while the same pair without the flag returns two.