fix(interactions): stop duplicate slash command and component execution#123
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(interactions): stop duplicate slash command and component execution#123cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
… handlers Guild interactionCreate and components handlers ran in parallel with the validations chain, both calling command.run() before either replied. This duplicated economy writes (/deposit, /withdraw) and component actions. Validators remain the sole execution path; backup handlers are no-ops. Co-authored-by: zVapor_ <contact@zvapor.xyz>
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.
Bug and impact
Every slash command and registered button/select/modal was executed twice per interaction. Both the Guild backup handlers (
interactionCreate.js,components.js) and the validations chain registered separateinteractionCreatelisteners that calledcommand.run()/component.run()concurrently before either path replied.Concrete scenario: A user runs
/deposit amount:allwith $500 in wallet. Both handlers read wallet=500, both move $500 to bank, and both persist — creating $1000 in bank from $500 wallet (money duplication). Same pattern affects/withdraw,/beg,/rob, economy button flows, and any component action.Root cause
PR #67 restored per-module Guild event registration (
c430893), re-enablingGuild/interactionCreate.jsandGuild/components.jsas active routers. The validations chain already executes commands after permission checks. The Guild handlers'interaction.replied || interaction.deferredguard does not help because all async listeners start in the same emit tick before any reply.Fix
tests/interaction-execution-single-path.test.js) asserting backup handlers do not call.run()and validators still do.Validation
npm test— 40/40 passing