Skip to content

Commit

Permalink
fix(commands): content must be 2000 or fewer
Browse files Browse the repository at this point in the history
  • Loading branch information
oddyamill committed Sep 25, 2024
1 parent cf2d40b commit bfb8377
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions internal/commands/responder.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ func (r *DiscordResponder) Respond() error {
content := r.Builder.String()
components := ParseDiscordKeyboard(r.Keyboard)

_, err := r.Session.InteractionResponseEdit(&r.Interaction, &discordgo.WebhookEdit{
Content: &content,
payload := &discordgo.WebhookEdit{
Components: &components,
})
}

if len(content) > 2000 {
payload.Embeds = &[]*discordgo.MessageEmbed{{Description: content}}
} else {
payload.Content = &content
}

_, err := r.Session.InteractionResponseEdit(&r.Interaction, payload)
return err
}

Expand Down Expand Up @@ -112,6 +118,7 @@ func (r *DiscordResponder) RespondWithDefer() error {
Type: discordgo.InteractionResponseUpdateMessage,
Data: &discordgo.InteractionResponseData{
Content: r.Interaction.Message.Content,
Embeds: r.Interaction.Message.Embeds,
Components: r.Interaction.Message.Components,
},
})
Expand Down

0 comments on commit bfb8377

Please sign in to comment.