fix: edit type editReply argument

This commit is contained in:
Siwoo Jeon 2025-05-23 23:28:37 +09:00
parent aaf5246218
commit 0fdfd1cbd7
Signed by: migan
GPG key ID: 036E9A8C5E8E48DA
3 changed files with 16 additions and 4 deletions

View file

@ -70,7 +70,7 @@ var DeleteLearnedDataComponent *commands.Component = &commands.Component{
databases.Database.Learns.DeleteOne(context.TODO(), bson.D{{Key: "_id", Value: id}})
i.EditReply(&discordgo.WebhookEdit{
i.EditReply(&utils.InteractionEdit{
Embeds: &[]*discordgo.MessageEmbed{
{
Title: "✅ 삭제 완료",

View file

@ -16,6 +16,15 @@ type ModalData struct {
Components []discordgo.MessageComponent `json:"components"`
}
type InteractionEdit struct {
Content *string `json:"content,omitempty"`
Components *[]discordgo.MessageComponent `json:"components,omitempty"`
Embeds *[]*discordgo.MessageEmbed `json:"embeds,omitempty"`
Flags *discordgo.MessageFlags `json:"flags,omitempty"`
Attachments *[]*discordgo.MessageAttachment `json:"attachments,omitempty"`
AllowedMentions *discordgo.MessageAllowedMentions `json:"allowed_mentions,omitempty"`
}
// InteractionCreate custom data of discordgo.InteractionCreate
type InteractionCreate struct {
*discordgo.InteractionCreate
@ -73,10 +82,13 @@ func (i *InteractionCreate) DeferUpdate() {
}
// EditReply to this interaction.
func (i *InteractionCreate) EditReply(data *discordgo.WebhookEdit) {
i.Session.InteractionResponseEdit(i.Interaction, data)
func (i *InteractionCreate) EditReply(data *InteractionEdit) error {
endpoint := discordgo.EndpointWebhookMessage(i.AppID, i.Token, "@original")
_, err := i.Session.RequestWithBucketID("PATCH", endpoint, *data, discordgo.EndpointWebhookToken("", ""))
i.Replied = true
return err
}
// Update to this interaction.

View file

@ -76,7 +76,7 @@ func (s *MessageSender) Send() {
}
if m.Replied || m.Deferred {
m.EditReply(&discordgo.WebhookEdit{
err := m.EditReply(&InteractionEdit{
Content: &s.Content,
Embeds: &s.Embeds,
Components: &s.Components,