fix: edit type editReply argument
This commit is contained in:
parent
aaf5246218
commit
0fdfd1cbd7
3 changed files with 16 additions and 4 deletions
|
@ -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: "✅ 삭제 완료",
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue