-
Notifications
You must be signed in to change notification settings - Fork 3
✨ feat: defer interaction and follow on permission dialogs #2328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||
| if err != nil { | ||||||
| log.Println("Error updating coop status permission dialog:", err) | ||||||
| } | ||||||
|
|
@@ -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") | ||||||
|
||||||
| respondAndClose("I understand") | |
| respondAndClose("Dialog closed. You can enable coop status permission later if needed.") |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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) | ||||||
|
||||||
| _, err = s.FollowupMessageEdit(i.Interaction, i.Message.ID, &edit) | |
| _, err = s.InteractionResponseEdit(i.Interaction, &edit) |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
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.
| respondAndClose("I understand") | |
| respondAndClose("Dialog closed.") |
There was a problem hiding this comment.
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 useInteractionResponseEdit(edit@original).FollowupMessageEdit(i.Interaction, i.Message.ID, ...)targets follow-up messages and may fail for this dialog message, leaving the components in place.