Skip to content

✨ feat(leaderboard): acknowledge interaction updates to avoid timeouts#2326

Merged
mkmccarty merged 1 commit intomainfrom
mm-branch-1
Apr 5, 2026
Merged

✨ feat(leaderboard): acknowledge interaction updates to avoid timeouts#2326
mkmccarty merged 1 commit intomainfrom
mm-branch-1

Conversation

@mkmccarty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 5, 2026 18:05
@mkmccarty mkmccarty merged commit c21560c into main Apr 5, 2026
12 checks passed
@mkmccarty mkmccarty deleted the mm-branch-1 branch April 5, 2026 18:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the leaderboard component-interaction handling to defer/acknowledge only the interactions that mutate the existing leaderboard message, reducing the chance of Discord interaction timeouts.

Changes:

  • Move interaction acknowledgement out of the top-level handler and into specific cases (close, refresh, season).
  • Add permission checks for refresh/season before proceeding with leaderboard updates.
  • Improve per-action error log messages for interaction responses.
Comments suppressed due to low confidence (1)

src/boost/leaderboard.go:114

  • HandleLeaderboardPage now returns early when CustomID is malformed (len(parts) < 2) without sending any interaction response. That will cause Discord to show “This interaction failed” (timeout) for those cases. Consider acknowledging even on invalid/unknown CustomID (e.g., defer message update or send an ephemeral error) and/or add a default branch in the switch to always respond.
	parts := strings.Split(i.MessageComponentData().CustomID, "#")
	if len(parts) < 2 {
		return
	}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/boost/leaderboard.go
Comment on lines +121 to +128
// Acknowledge update interactions that mutate the existing leaderboard message.
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseDeferredMessageUpdate,
Data: &discordgo.InteractionResponseData{
Flags: flags,
Components: []discordgo.MessageComponent{},
},
})
Copy link

Copilot AI Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same InteractionRespond(...DeferredMessageUpdate...) acknowledgement block is duplicated across close, refresh, and season. To reduce drift (e.g., flags/components/log messages getting out of sync), consider extracting this into a small helper (or at least a local function) used by each case.

Copilot uses AI. Check for mistakes.
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.

2 participants