From 7aef76f4328718f77b37bf5a6eebf7f0c01bc5cc Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 23 Jan 2020 17:29:09 +0600 Subject: [PATCH] PollAnswerUpdate --- CHANGELOG.md | 1 + .../TelegramBotAPI/types/update/PollAnswerUpdate.kt | 10 ++++++++++ .../TelegramBotAPI/types/update/RawUpdate.kt | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index bf11583178..3e6104149d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * `language` field in PreTextSource now correctly passed from telegram MessageEntities * `PollAnswer` type was added * `Poll#createRequest` extension was added +* `PollAnswerUpdate` type of update was added ## 0.22.0 diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt new file mode 100644 index 0000000000..680ee33ad8 --- /dev/null +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt @@ -0,0 +1,10 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types.update + +import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.polls.PollAnswer +import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update + +data class PollAnswerUpdate( + override val updateId: UpdateIdentifier, + override val data: PollAnswer +) : Update diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt index 287dbeb4d8..5ccd666095 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt @@ -9,6 +9,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Telegr import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll +import com.github.insanusmokrassar.TelegramBotAPI.types.polls.PollAnswer import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UnknownUpdateType import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField @@ -33,7 +34,8 @@ internal data class RawUpdate constructor( private val callback_query: RawCallbackQuery? = null, private val shipping_query: ShippingQuery? = null, private val pre_checkout_query: PreCheckoutQuery? = null, - private val poll: Poll? = null + private val poll: Poll? = null, + private val poll_answer: PollAnswer? = null ) { private var initedUpdate: Update? = null /** @@ -55,6 +57,7 @@ internal data class RawUpdate constructor( shipping_query != null -> ShippingQueryUpdate(updateId, shipping_query) pre_checkout_query != null -> PreCheckoutQueryUpdate(updateId, pre_checkout_query) poll != null -> PollUpdate(updateId, poll) + poll_answer != null -> PollAnswerUpdate(updateId, poll_answer) else -> UnknownUpdateType( updateId, raw.toString()