-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat: Add support for Automated Message nonce handling #10381
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
packages/discord.js/src/structures/interfaces/TextBasedChannel.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle when enforceNonce: false
is explicitly passed?
const createdMessage = await message.channel.send({
content: "hello",
enforceNonce: false,
});
// `createdMessage` has a nonce which is enforced despite `enforceNonce` being `false`.
packages/discord.js/src/structures/interfaces/TextBasedChannel.js
Outdated
Show resolved
Hide resolved
…to not generate a nonce, and PR feedback
packages/discord.js/src/structures/interfaces/TextBasedChannel.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Almeida <github@almeidx.dev>
@JMTK you force pushed, which (i assume unintentionally) closed the PR |
oh woops, i thought i had it on a branch. i was working on creating a new PR and accidentally did that Fixed! |
Resolved
See: * https://discord.com/developers/docs/change-log#enforced-nonces-on-create-message-endpoint * discordjs/discord.js#10301 A (hopefully) upcoming discord.js change will simplify this: discordjs/discord.js#10381
* Add support for Automated Message nonce handling * Fix options property * Address PR feedback * Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback * Fix lint issue * Fix lint issue * Move to MessagePayload.resolveBody instead * Fix test errors * Update packages/discord.js/src/structures/MessagePayload.js Co-authored-by: Almeida <github@almeidx.dev> * PR feedback * Merge * Let and not const --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me>
* build: bump discord-api-types to 0.37.95 * feat: Add support for Automated Message nonce handling (#10381) * Add support for Automated Message nonce handling * Fix options property * Address PR feedback * Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback * Fix lint issue * Fix lint issue * Move to MessagePayload.resolveBody instead * Fix test errors * Update packages/discord.js/src/structures/MessagePayload.js Co-authored-by: Almeida <github@almeidx.dev> * PR feedback * Merge * Let and not const --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me> * feat(Attachment): add `title` (#10423) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * types: Fix wrong auto moderation target type (#10391) types: fix wrong auto moderation target type Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * feat(builders): update to @sapphire/shapeshift v4 (#10291) feat: update to @sapphire/shapeshift v4 * refactor(actions): safer getChannel calls (#10434) * refactor(actions): safer getChannel calls * chore: consistency --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * build: bump discord-api-types tp 0.37.96 --------- Co-authored-by: Jacob Morrison <jake.morrison24@gmail.com> Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me> Co-authored-by: Danial Raza <danialrazafb@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Jeroen Claassens <support@favware.tech> Co-authored-by: DD <didinele.dev@gmail.com>
* Add support for Automated Message nonce handling * Fix options property * Address PR feedback * Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback * Fix lint issue * Fix lint issue * Move to MessagePayload.resolveBody instead * Fix test errors * Update packages/discord.js/src/structures/MessagePayload.js Co-authored-by: Almeida <github@almeidx.dev> * PR feedback * Merge * Let and not const --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me>
* build: bump discord-api-types to 0.37.95 * feat: Add support for Automated Message nonce handling (discordjs#10381) * Add support for Automated Message nonce handling * Fix options property * Address PR feedback * Handled case where it was explicitly set to false for that iteration to not generate a nonce, and PR feedback * Fix lint issue * Fix lint issue * Move to MessagePayload.resolveBody instead * Fix test errors * Update packages/discord.js/src/structures/MessagePayload.js Co-authored-by: Almeida <github@almeidx.dev> * PR feedback * Merge * Let and not const --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me> * feat(Attachment): add `title` (discordjs#10423) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * types: Fix wrong auto moderation target type (discordjs#10391) types: fix wrong auto moderation target type Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * feat(builders): update to @sapphire/shapeshift v4 (discordjs#10291) feat: update to @sapphire/shapeshift v4 * refactor(actions): safer getChannel calls (discordjs#10434) * refactor(actions): safer getChannel calls * chore: consistency --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * build: bump discord-api-types tp 0.37.96 --------- Co-authored-by: Jacob Morrison <jake.morrison24@gmail.com> Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Almeida <almeidx@pm.me> Co-authored-by: Danial Raza <danialrazafb@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Jeroen Claassens <support@favware.tech> Co-authored-by: DD <didinele.dev@gmail.com>
Please describe the changes this PR makes and why it should be merged:
Took a stab at doing this, let me know if there's any issues! Fixes #10323
Only thing I thought about was to instead make this a function you can pass in to generate nonces, so something like
But the users may run into issues, such as the 25 character limit, generating high collision nonces, etc
Status and versioning classification:
Minor