From b4557cf350709c372d4f0ebf4dfaac7916b3bea1 Mon Sep 17 00:00:00 2001 From: sebm253 <42180891+sebm253@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:54:31 +0100 Subject: [PATCH] Fix GetPollAnswerVotes deserialization Fixes #399, closes #400 --- rest/channels.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rest/channels.go b/rest/channels.go index 477d0107..83094eec 100644 --- a/rest/channels.go +++ b/rest/channels.go @@ -232,7 +232,11 @@ func (s *channelImpl) GetPollAnswerVotes(channelID snowflake.ID, messageID snowf if limit != 0 { values["limit"] = limit } - err = s.client.Do(GetPollAnswerVotes.Compile(values, channelID, messageID, answerID), nil, &users, opts...) + var rs pollAnswerVotesResponse + err = s.client.Do(GetPollAnswerVotes.Compile(values, channelID, messageID, answerID), nil, &rs, opts...) + if err == nil { + users = rs.Users + } return } @@ -249,3 +253,7 @@ func (s *channelImpl) ExpirePoll(channelID snowflake.ID, messageID snowflake.ID, err = s.client.Do(ExpirePoll.Compile(nil, channelID, messageID), nil, &message, opts...) return } + +type pollAnswerVotesResponse struct { + Users []discord.User `json:"users"` +}