Skip to content

Commit

Permalink
Fix GetPollAnswerVotes deserialization
Browse files Browse the repository at this point in the history
Fixes #399, closes #400
  • Loading branch information
sebm253 committed Nov 8, 2024
1 parent 38427de commit b4557cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rest/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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"`
}

0 comments on commit b4557cf

Please sign in to comment.