add deter_update and update instructions to discordinteraction - #66
Open
BehrRiley wants to merge 3 commits into
Open
add deter_update and update instructions to discordinteraction#66BehrRiley wants to merge 3 commits into
deter_update and update instructions to discordinteraction#66BehrRiley wants to merge 3 commits into
Conversation
- add `defer_update` to acknowledge a component interaction without a loading state - add `update` to immediately edit the original message of a component interaction - require `IMessageEditCallback` validation for the new instructions - update meta to clarify differences between `defer`, `defer_update`, `edit`, and `update` - add meta usage examples for the new instructions
MC-Samuel
reviewed
Sep 4, 2026
| yield ((IReplyCallback) interaction.interaction).deferReply(ephemeral); | ||
| } | ||
| case DEFER_UPDATE -> { | ||
| if (!(interaction.interaction instanceof IMessageEditCallback)) { |
Contributor
There was a problem hiding this comment.
Can use pattern matching here.
| // 'defer_update' acknowledges a component interaction without a loading state, allowing its original message to be edited later. | ||
| // 'reply' provides the initial interaction response, or sends a followup after the interaction has been acknowledged. It uses similar logic to normal messaging. See <@link command discordmessage>. | ||
| // 'update' immediately updates the message associated with a component interaction as its initial response. | ||
| // 'edit' edits the interaction's original response through its interaction hook, and 'delete' deletes that original response. |
Contributor
There was a problem hiding this comment.
Since these are two different options, they should be on separate lines.
- apply review feedback for component interaction updates - use pattern matching for message edit callbacks, clarify the individual interaction instructions, and document update and deferred-update usage meta
MC-Samuel
reviewed
Sep 4, 2026
| // Use to silently acknowledge a component interaction, then update its original message later. | ||
| // - ~discordinteraction defer_update interaction:<context.interaction> | ||
| // - wait 2s | ||
| // - discordinteraction edit interaction:<context.interaction> Updated after processing. |
Contributor
There was a problem hiding this comment.
Text containing multiple words, if part of the same argument, should be surrounded by quotation marks.
mcmonkey4eva
approved these changes
Sep 5, 2026
mcmonkey4eva
left a comment
Member
There was a problem hiding this comment.
Code and doc changes look clean and proper to me at a skim.
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.
Summary
adds support for the two missing component-interaction response modes to
discordinteraction; discord thread reference: (ikuria) discord buttonpress without alert. this feature request only included one of two missing components, however Discord describes the two callbacks elaborated below as a pair:defer_updatefor DiscordDEFERRED_UPDATE_MESSAGEcallback (type6)updatefor DiscordUPDATE_MESSAGEcallback (type7)these are specifically intended for button/select-menu interactions.
relevant documentation for reference: https://docs.discord.com/developers/interactions/receiving-and-responding#interaction-response-object
Problem
dDiscordBot previously supported normal interaction replies/deferred replies and editing the interaction’s original response, but didn't provide the two component-specific acknowledgement/update paths:
Changes
defer_updateusing JDA’sIMessageEditCallback.deferEdit()Thinking...stateeditinstruction to update the original component message afterwardsupdateusing JDA’sIMessageEditCallback.editMessage(MessageEditData)discordinteractionmeta for the new instructionspreviously, terms like
defer,reply, andeditcould be ambiguous; withdefer_updateandupdate, the meta should make that distinction now:deferis to acknowledge now, reply laterdefer_updateis to acknowledge a component now, update it's message laterreplyis to respond with a messageupdateis to immediately update the component's messageeditis to edit an already-established interaction responsethe change isn't just for the new extra documentation, it makes the command names and their different Discord behaviors easier to understand now
Testing
update: clicking the test button immediately edited the message containing that button; no followup was created and Discord displayed no interaction failuredefer_update: clicking the test button acknowledged immediately without a visible loading/thinking/typing states; after a two-second delay, existingeditupdated the same original component message.deferfollowed byeditreplydeleteThe test-server startup log includes unrelated warnings during startup; the server, Denizen, dDiscordBot, and JDA all completed startup normally; these warnings aren't relevant and don't affect the interaction tests
here's a startup log referencing this test with everything above:
https://files.behr.dev/file-share/dDiscordBot-0.7.1-interaction-updates-latest.log.txt
a working build of my latest successful build which has no errors can be built with this branch or found at:
https://files.behr.dev/file-share/dDiscordBot-0.7.1-interaction-updates.jar