diff --git a/discord/emoji.go b/discord/emoji.go index 94d7fcef..896efd11 100644 --- a/discord/emoji.go +++ b/discord/emoji.go @@ -66,9 +66,9 @@ type EmojiUpdate struct { } type PartialEmoji struct { - ID *snowflake.ID `json:"id"` - Name *string `json:"name"` - Animated bool `json:"animated"` + ID *snowflake.ID `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Animated bool `json:"animated,omitempty"` } // Reaction returns a string used for manipulating with reactions. May be empty if the Name is nil diff --git a/discord/message_create.go b/discord/message_create.go index 9c8f8d05..0527ca15 100644 --- a/discord/message_create.go +++ b/discord/message_create.go @@ -18,7 +18,7 @@ type MessageCreate struct { MessageReference *MessageReference `json:"message_reference,omitempty"` Flags MessageFlags `json:"flags,omitempty"` EnforceNonce bool `json:"enforce_nonce,omitempty"` - Poll Poll `json:"poll,omitempty"` + Poll PollCreate `json:"poll,omitempty"` } func (MessageCreate) interactionCallbackData() {} diff --git a/discord/message_create_builder.go b/discord/message_create_builder.go index d53facaf..ed570fe9 100644 --- a/discord/message_create_builder.go +++ b/discord/message_create_builder.go @@ -252,7 +252,7 @@ func (b *MessageCreateBuilder) SetSuppressEmbeds(suppressEmbeds bool) *MessageCr } // SetPoll sets the Poll of the Message -func (b *MessageCreateBuilder) SetPoll(poll Poll) *MessageCreateBuilder { +func (b *MessageCreateBuilder) SetPoll(poll PollCreate) *MessageCreateBuilder { b.Poll = poll return b } diff --git a/discord/poll.go b/discord/poll.go index 8d0c7793..5319d415 100644 --- a/discord/poll.go +++ b/discord/poll.go @@ -15,13 +15,21 @@ type Poll struct { Results []PollResults `json:"results"` } +type PollCreate struct { + Question PollMedia `json:"question"` + Answers []PollAnswer `json:"answers"` + Duration int `json:"duration"` + AllowMultiselect bool `json:"allow_multiselect"` + LayoutType PollLayoutType `json:"layout_type,omitempty"` +} + type PollMedia struct { Text *string `json:"text"` - Emoji *PartialEmoji `json:"emoji"` + Emoji *PartialEmoji `json:"emoji,omitempty"` } type PollAnswer struct { - AnswerID *int `json:"answer_id"` + AnswerID *int `json:"answer_id,omitempty"` PollMedia PollMedia `json:"poll_media"` } diff --git a/discord/webhook_message_create.go b/discord/webhook_message_create.go index 468297df..40ded2c8 100644 --- a/discord/webhook_message_create.go +++ b/discord/webhook_message_create.go @@ -15,7 +15,7 @@ type WebhookMessageCreate struct { Flags MessageFlags `json:"flags,omitempty"` ThreadName string `json:"thread_name,omitempty"` AppliedTags []snowflake.ID `json:"applied_tags,omitempty"` - Poll Poll `json:"poll,omitempty"` + Poll PollCreate `json:"poll,omitempty"` } // ToBody returns the MessageCreate ready for body diff --git a/discord/webhook_message_create_builder.go b/discord/webhook_message_create_builder.go index 82d31ee8..0a93a49e 100644 --- a/discord/webhook_message_create_builder.go +++ b/discord/webhook_message_create_builder.go @@ -211,7 +211,7 @@ func (b *WebhookMessageCreateBuilder) SetThreadName(threadName string) *WebhookM } // SetPoll sets the Poll of the webhook Message -func (b *WebhookMessageCreateBuilder) SetPoll(poll Poll) *WebhookMessageCreateBuilder { +func (b *WebhookMessageCreateBuilder) SetPoll(poll PollCreate) *WebhookMessageCreateBuilder { b.Poll = poll return b }