Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/boost/coop_status_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,23 @@ func HandleCoopStatusPermissionButton(s *discordgo.Session, i *discordgo.Interac
customID := i.MessageComponentData().CustomID
respondAndClose := func(content string) {
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseUpdateMessage,
Type: discordgo.InteractionResponseDeferredMessageUpdate,
Data: &discordgo.InteractionResponseData{
Content: content,
Flags: discordgo.MessageFlagsEphemeral,
Components: []discordgo.MessageComponent{},
},
})
if err != nil {
log.Println("Error acknowledging coop status permission dialog:", err)
return
}

emptyComponents := []discordgo.MessageComponent{}
edit := discordgo.WebhookEdit{
Content: &content,
Components: &emptyComponents,
}
_, err = s.FollowupMessageEdit(i.Interaction, i.Message.ID, &edit)
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.

Same issue as the leaderboard permission dialog: after replying with DeferredMessageUpdate, updating the original permission dialog message should use InteractionResponseEdit (edit @original). FollowupMessageEdit(i.Interaction, i.Message.ID, ...) targets follow-up messages and may fail for this dialog message, leaving the components in place.

Suggested change
_, err = s.FollowupMessageEdit(i.Interaction, i.Message.ID, &edit)
_, err = s.InteractionResponseEdit(i.Interaction, &edit)

Copilot uses AI. Check for mistakes.
if err != nil {
log.Println("Error updating coop status permission dialog:", err)
}
Expand Down Expand Up @@ -146,6 +156,6 @@ func HandleCoopStatusPermissionButton(s *discordgo.Session, i *discordgo.Interac
respondAndClose("Permission granted for 7 days. You can now run your command again.")

case "close":
respondAndClose("Dialog closed. You can enable this permission later when you're ready.")
respondAndClose("I understand")
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 close response text was changed to "I understand", which removes the previous guidance (“Dialog closed… enable later…”). This makes it unclear that the dialog was dismissed and that the user can re-enable permission later; consider restoring a more descriptive close message.

Suggested change
respondAndClose("I understand")
respondAndClose("Dialog closed. You can enable coop status permission later if needed.")

Copilot uses AI. Check for mistakes.
}
}
16 changes: 13 additions & 3 deletions src/boost/leaderboard_permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,23 @@ func HandleLeaderboardPermissionButton(s *discordgo.Session, i *discordgo.Intera
customID := i.MessageComponentData().CustomID
respondAndClose := func(content string) {
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseUpdateMessage,
Type: discordgo.InteractionResponseDeferredMessageUpdate,
Data: &discordgo.InteractionResponseData{
Content: content,
Flags: discordgo.MessageFlagsEphemeral,
Components: []discordgo.MessageComponent{},
},
})
if err != nil {
log.Println("Error acknowledging leaderboard permission dialog:", err)
return
}

emptyComponents := []discordgo.MessageComponent{}
edit := discordgo.WebhookEdit{
Content: &content,
Components: &emptyComponents,
}
_, err = s.FollowupMessageEdit(i.Interaction, i.Message.ID, &edit)
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.

ShowLeaderboardPermissionDialog creates the dialog message via InteractionRespond(ChannelMessageWithSource), so after DeferredMessageUpdate the correct way to update that original dialog is InteractionResponseEdit (edits @original). Using FollowupMessageEdit(i.Interaction, i.Message.ID, ...) can fail because the dialog message is not a follow-up message for this interaction token, which would leave the buttons/content unchanged.

Suggested change
_, err = s.FollowupMessageEdit(i.Interaction, i.Message.ID, &edit)
_, err = s.InteractionResponseEdit(i.Interaction, &edit)

Copilot uses AI. Check for mistakes.
if err != nil {
log.Println("Error updating leaderboard permission dialog:", err)
}
Expand All @@ -122,6 +132,6 @@ func HandleLeaderboardPermissionButton(s *discordgo.Session, i *discordgo.Intera
respondAndClose("Permission granted permanently. Please run your command again.")

case "close":
respondAndClose("Dialog closed.")
respondAndClose("I understand")
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 updated close response text ("I understand") is ambiguous: it doesn't indicate that the dialog was closed or what the user should do next. Consider keeping a clearer message like “Dialog closed.” (and, for coop-status, the prior guidance about enabling later) so users understand the outcome.

Suggested change
respondAndClose("I understand")
respondAndClose("Dialog closed.")

Copilot uses AI. Check for mistakes.
}
}
Loading