Repository navigation
fix(bot): defer-first in play command and guard deferReply against 40060 - #431
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR addresses Discord interaction acknowledgement race conditions by deferring interaction replies earlier in the command execution lifecycle and wrapping acknowledgement calls with try-catch error handling to gracefully discard duplicate/concurrent acknowledgement errors (40060). Changes
Sequence Diagram(s)sequenceDiagram
actor Client as Discord Client
participant Play as Play Command
participant IH as Interaction Handler
Client->>Play: Execute play command
Play->>IH: deferReply() [at start]
IH->>IH: try: await deferReply()
IH-->>Play: Acknowledged (or error caught)
alt Validation Failure
Play->>IH: editReply(embed)
IH->>IH: try: await editReply()
IH-->>Play: Reply sent (or error caught)
else Success/Continue
Play->>Play: Queue/playback logic
Play->>IH: editReply(embed)
IH->>IH: try: await editReply()
IH-->>Play: Reply sent (or error caught)
end
Play-->>Client: Command result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: 0 B Total Size: 318 kB ℹ️ View Unchanged
|
|


Summary
deferReply()to the top of play commandexecute, before guildId/voice/collaborative checks. Converts early-exitreply()toeditReply(). Fixes LUCKY-1Y (Unknown interaction on early exits).deferReply()inhandleChatInputCommandandhandleOtherInteractionin a try-catch — if the interaction is already acknowledged (40060) or expired (10062), we silently return instead of throwing. Fixes LUCKY-23.Test plan
/playcommand responds even when user is not in a voice channelDiscordAPIError[40060]in SentrySummary by CodeRabbit