Skip to content

Commit

Permalink
fix AnswerID type
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Mar 21, 2024
1 parent f842904 commit 05382f1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions discord/poll.go
Expand Up @@ -12,7 +12,7 @@ type Poll struct {
Expiry time.Time `json:"expiry"`
AllowMultiselect bool `json:"allow_multiselect"`
LayoutType PollLayoutType `json:"layout_type"`
Results []PollResults `json:"results"`
Results []PollResults `json:"results,omitempty"`
}

type PollMedia struct {
Expand All @@ -21,8 +21,8 @@ type PollMedia struct {
}

type PollAnswer struct {
AnswerID *snowflake.ID `json:"answer_id"`
PollMedia PollMedia `json:"poll_media"`
AnswerID *int `json:"answer_id"`
PollMedia PollMedia `json:"poll_media"`
}

type PollResults struct {
Expand Down
2 changes: 1 addition & 1 deletion events/message_events.go
Expand Up @@ -51,7 +51,7 @@ type GenericMessagePoll struct {
ChannelID snowflake.ID
MessageID snowflake.ID
GuildID *snowflake.ID
AnswerID snowflake.ID
AnswerID int
}

// MessagePollVoteAdd indicates that a discord.User voted on a discord.Poll
Expand Down
4 changes: 2 additions & 2 deletions gateway/gateway_events.go
Expand Up @@ -512,7 +512,7 @@ type EventMessagePollVoteAdd struct {
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
AnswerID snowflake.ID `json:"answer_id"`
AnswerID int `json:"answer_id"`
}

func (EventMessagePollVoteAdd) messageData() {}
Expand All @@ -523,7 +523,7 @@ type EventMessagePollVoteRemove struct {
ChannelID snowflake.ID `json:"channel_id"`
MessageID snowflake.ID `json:"message_id"`
GuildID *snowflake.ID `json:"guild_id"`
AnswerID snowflake.ID `json:"answer_id"`
AnswerID int `json:"answer_id"`
}

func (EventMessagePollVoteRemove) messageData() {}
Expand Down
4 changes: 2 additions & 2 deletions rest/channels.go
Expand Up @@ -48,7 +48,7 @@ type Channels interface {
UnpinMessage(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) error
Follow(channelID snowflake.ID, targetChannelID snowflake.ID, opts ...RequestOpt) (*discord.FollowedChannel, error)

GetPollAnswerVotes(channelID snowflake.ID, messageID snowflake.ID, answerID snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.User, error)
GetPollAnswerVotes(channelID snowflake.ID, messageID snowflake.ID, answerID int, after snowflake.ID, limit int, opts ...RequestOpt) ([]discord.User, error)
ExpirePoll(channelID snowflake.ID, messageID snowflake.ID, opts ...RequestOpt) (*discord.Message, error)
}

Expand Down Expand Up @@ -226,7 +226,7 @@ func (s *channelImpl) Follow(channelID snowflake.ID, targetChannelID snowflake.I
return
}

func (s *channelImpl) GetPollAnswerVotes(channelID snowflake.ID, messageID snowflake.ID, answerID snowflake.ID, after snowflake.ID, limit int, opts ...RequestOpt) (users []discord.User, err error) {
func (s *channelImpl) GetPollAnswerVotes(channelID snowflake.ID, messageID snowflake.ID, answerID int, after snowflake.ID, limit int, opts ...RequestOpt) (users []discord.User, err error) {
values := discord.QueryValues{}
if after != 0 {
values["after"] = after
Expand Down

0 comments on commit 05382f1

Please sign in to comment.