Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Message nonce handling #10323

Closed
DEVTomatoCake opened this issue Jun 3, 2024 · 1 comment · Fixed by #10381
Closed

Automated Message nonce handling #10323

DEVTomatoCake opened this issue Jun 3, 2024 · 1 comment · Fixed by #10381

Comments

@DEVTomatoCake
Copy link

Which application or package is this feature request for?

discord.js

Feature

Discord recently added support for enforcing the nonce parameter when creating a Message, to be able to prevent duplicate messages in a short amount of time.

When using this, currently developers have to specify both a random nonce and enforceNonce: true either in every <BaseChannel>.send() function in the payload, or extend the class(es) themselves to handle it everywhere.

Ideal solution or implementation

A client option, disabled by default, to automatically generate a nonce (e.g. using SnowflakeUtil.generate().toString()) and set both nonce and (while it's still required) enforceNonce when creating a Message, unless one or both of those parameters are already present in the payload.

Alternative solutions or implementations

A Message payload parameter like sendNonce which does the same as above, but it's per Message instead of globally.

Other context

See #10301 for why this could be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants