diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt index 906ea75281..65b1cefe2d 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -90,6 +90,7 @@ const val lastErrorDateField = "last_error_date" const val lastErrorMessageField = "last_error_message" const val votesCountField = "voter_count" const val isClosedField = "is_closed" +const val totalVoterCountField = "total_voter_count" const val correctOptionIdField = "correct_option_id" const val allowsMultipleAnswersField = "allows_multiple_answers" const val isAnonymousField = "is_anonymous" diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt index d65df26aa6..cf142a16a9 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt @@ -10,6 +10,7 @@ sealed class Poll { abstract val id: PollIdentifier abstract val question: String abstract val options: List + abstract val votesCount: Int abstract val closed: Boolean abstract val isAnonymous: Boolean } @@ -22,6 +23,8 @@ data class UnknownPollType( override val question: String, @SerialName(optionsField) override val options: List, + @SerialName(totalVoterCountField) + override val votesCount: Int, @SerialName(isClosedField) override val closed: Boolean = false, @SerialName(isAnonymousField) @@ -37,6 +40,8 @@ data class RegularPoll( override val question: String, @SerialName(optionsField) override val options: List, + @SerialName(totalVoterCountField) + override val votesCount: Int, @SerialName(isClosedField) override val closed: Boolean = false, @SerialName(isAnonymousField) @@ -53,6 +58,8 @@ data class QuizPoll( override val question: String, @SerialName(optionsField) override val options: List, + @SerialName(totalVoterCountField) + override val votesCount: Int, @SerialName(isClosedField) override val closed: Boolean = false, @SerialName(isAnonymousField) @@ -83,6 +90,7 @@ internal object PollSerializer : KSerializer { pollOptionsSerializer, asJson.getArray(optionsField) ), + asJson.getPrimitive(totalVoterCountField).int, asJson.getPrimitiveOrNull(isClosedField) ?.booleanOrNull ?: false, asJson.getPrimitiveOrNull(isAnonymousField) ?.booleanOrNull ?: true, asJson.toString()