mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
added votes count field to poll
This commit is contained in:
parent
423efafa04
commit
258ab44bac
@ -90,6 +90,7 @@ const val lastErrorDateField = "last_error_date"
|
|||||||
const val lastErrorMessageField = "last_error_message"
|
const val lastErrorMessageField = "last_error_message"
|
||||||
const val votesCountField = "voter_count"
|
const val votesCountField = "voter_count"
|
||||||
const val isClosedField = "is_closed"
|
const val isClosedField = "is_closed"
|
||||||
|
const val totalVoterCountField = "total_voter_count"
|
||||||
const val correctOptionIdField = "correct_option_id"
|
const val correctOptionIdField = "correct_option_id"
|
||||||
const val allowsMultipleAnswersField = "allows_multiple_answers"
|
const val allowsMultipleAnswersField = "allows_multiple_answers"
|
||||||
const val isAnonymousField = "is_anonymous"
|
const val isAnonymousField = "is_anonymous"
|
||||||
|
@ -10,6 +10,7 @@ sealed class Poll {
|
|||||||
abstract val id: PollIdentifier
|
abstract val id: PollIdentifier
|
||||||
abstract val question: String
|
abstract val question: String
|
||||||
abstract val options: List<PollOption>
|
abstract val options: List<PollOption>
|
||||||
|
abstract val votesCount: Int
|
||||||
abstract val closed: Boolean
|
abstract val closed: Boolean
|
||||||
abstract val isAnonymous: Boolean
|
abstract val isAnonymous: Boolean
|
||||||
}
|
}
|
||||||
@ -22,6 +23,8 @@ data class UnknownPollType(
|
|||||||
override val question: String,
|
override val question: String,
|
||||||
@SerialName(optionsField)
|
@SerialName(optionsField)
|
||||||
override val options: List<PollOption>,
|
override val options: List<PollOption>,
|
||||||
|
@SerialName(totalVoterCountField)
|
||||||
|
override val votesCount: Int,
|
||||||
@SerialName(isClosedField)
|
@SerialName(isClosedField)
|
||||||
override val closed: Boolean = false,
|
override val closed: Boolean = false,
|
||||||
@SerialName(isAnonymousField)
|
@SerialName(isAnonymousField)
|
||||||
@ -37,6 +40,8 @@ data class RegularPoll(
|
|||||||
override val question: String,
|
override val question: String,
|
||||||
@SerialName(optionsField)
|
@SerialName(optionsField)
|
||||||
override val options: List<PollOption>,
|
override val options: List<PollOption>,
|
||||||
|
@SerialName(totalVoterCountField)
|
||||||
|
override val votesCount: Int,
|
||||||
@SerialName(isClosedField)
|
@SerialName(isClosedField)
|
||||||
override val closed: Boolean = false,
|
override val closed: Boolean = false,
|
||||||
@SerialName(isAnonymousField)
|
@SerialName(isAnonymousField)
|
||||||
@ -53,6 +58,8 @@ data class QuizPoll(
|
|||||||
override val question: String,
|
override val question: String,
|
||||||
@SerialName(optionsField)
|
@SerialName(optionsField)
|
||||||
override val options: List<PollOption>,
|
override val options: List<PollOption>,
|
||||||
|
@SerialName(totalVoterCountField)
|
||||||
|
override val votesCount: Int,
|
||||||
@SerialName(isClosedField)
|
@SerialName(isClosedField)
|
||||||
override val closed: Boolean = false,
|
override val closed: Boolean = false,
|
||||||
@SerialName(isAnonymousField)
|
@SerialName(isAnonymousField)
|
||||||
@ -83,6 +90,7 @@ internal object PollSerializer : KSerializer<Poll> {
|
|||||||
pollOptionsSerializer,
|
pollOptionsSerializer,
|
||||||
asJson.getArray(optionsField)
|
asJson.getArray(optionsField)
|
||||||
),
|
),
|
||||||
|
asJson.getPrimitive(totalVoterCountField).int,
|
||||||
asJson.getPrimitiveOrNull(isClosedField) ?.booleanOrNull ?: false,
|
asJson.getPrimitiveOrNull(isClosedField) ?.booleanOrNull ?: false,
|
||||||
asJson.getPrimitiveOrNull(isAnonymousField) ?.booleanOrNull ?: true,
|
asJson.getPrimitiveOrNull(isAnonymousField) ?.booleanOrNull ?: true,
|
||||||
asJson.toString()
|
asJson.toString()
|
||||||
|
Loading…
Reference in New Issue
Block a user