From 4e1dbb8741446bf6fa3ef72df7447758173cd00d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 23 Jan 2020 17:17:24 +0600 Subject: [PATCH] PollAnswer --- CHANGELOG.md | 1 + .../TelegramBotAPI/types/Common.kt | 2 ++ .../TelegramBotAPI/types/polls/PollAnswer.kt | 15 +++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index cc56d45bbe..18bc057097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * `SendRegularPoll` was created and represent `sendPoll` method with type `regular` * `SendQuizPoll` was created and represent `sendPoll` method with type `quiz` * `language` field in PreTextSource now correctly passed from telegram MessageEntities +* `PollAnswer` type was added ## 0.22.0 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 65b1cefe2d..6f6be0af49 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Common.kt @@ -103,6 +103,7 @@ const val isAnimatedField = "is_animated" const val inviteLinkField = "invite_link" const val pinnedMessageField = "pinned_message" const val customTitleField = "custom_title" +const val optionIdsField = "option_ids" const val requestWriteAccessField = "request_write_access" @@ -177,6 +178,7 @@ const val pngStickerField = "png_sticker" const val okField = "ok" const val captionField = "caption" const val idField = "id" +const val pollIdField = "poll_id" const val textField = "text" const val thumbField = "thumb" const val emojiField = "emoji" diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt new file mode 100644 index 0000000000..bc8bfaac6e --- /dev/null +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt @@ -0,0 +1,15 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types.polls + +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class PollAnswer( + @SerialName(pollIdField) + val pollId: PollIdentifier, + @SerialName(userField) + val user: User, + @SerialName(optionIdsField) + val chosen: List +)