Skip to content
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

make WebhookEdit fields pointers #1174

Merged
merged 2 commits into from May 14, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions examples/slash_commands/main.go
Expand Up @@ -476,10 +476,11 @@ var (
return
}
time.AfterFunc(time.Second*5, func() {
content := content + "\n\nWell, now you know how to create and edit responses. " +
"But you still don't know how to delete them... so... wait 10 seconds and this " +
"message will be deleted."
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
Content: content + "\n\nWell, now you know how to create and edit responses. " +
"But you still don't know how to delete them... so... wait 10 seconds and this " +
"message will be deleted.",
Content: &content,
})
if err != nil {
s.FollowupMessageCreate(i.Interaction, true, &discordgo.WebhookParams{
Expand Down Expand Up @@ -517,8 +518,9 @@ var (
}
time.Sleep(time.Second * 5)

content := "Now the original message is gone and after 10 seconds this message will ~~self-destruct~~ be deleted."
s.FollowupMessageEdit(i.Interaction, msg.ID, &discordgo.WebhookEdit{
Content: "Now the original message is gone and after 10 seconds this message will ~~self-destruct~~ be deleted.",
Content: &content,
})

time.Sleep(time.Second * 10)
Expand Down
6 changes: 3 additions & 3 deletions webhook.go
Expand Up @@ -41,9 +41,9 @@ type WebhookParams struct {

// WebhookEdit stores data for editing of a webhook message.
type WebhookEdit struct {
Content string `json:"content,omitempty"`
Components []MessageComponent `json:"components"`
Embeds []*MessageEmbed `json:"embeds,omitempty"`
Content *string `json:"content,omitempty"`
Components *[]MessageComponent `json:"components,omitempty"`
Embeds *[]*MessageEmbed `json:"embeds,omitempty"`
Files []*File `json:"-"`
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
}