Skip to content

fix(interactions): stop duplicate slash command and component execution#123

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-23d2
Draft

fix(interactions): stop duplicate slash command and component execution#123
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-23d2

Conversation

@cursor

@cursor cursor Bot commented Jun 13, 2026

Copy link
Copy Markdown

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 separate interactionCreate listeners that called command.run() / component.run() concurrently before either path replied.

Concrete scenario: A user runs /deposit amount:all with $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-enabling Guild/interactionCreate.js and Guild/components.js as active routers. The validations chain already executes commands after permission checks. The Guild handlers' interaction.replied || interaction.deferred guard does not help because all async listeners start in the same emit tick before any reply.

Fix

  • Make Guild backup handlers no-ops; validators remain the sole execution path.
  • Add regression tests (tests/interaction-execution-single-path.test.js) asserting backup handlers do not call .run() and validators still do.

Validation

  • npm test — 40/40 passing
Open in Web View Automation 

… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant