diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e08a5c3e5..f2f24a1176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Type `PollOption` and `AnonymousPollOption` added * Type `Poll` added +* Type `PollUpdate` added and implemented in `RawUpdate`. Now `PollUpdate` can be retrieved from `RawUpdate` ## 0.12.0 Webhooks diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt new file mode 100644 index 0000000000..49a6e9131f --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.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.Poll +import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update + +data class PollUpdate( + override val updateId: UpdateIdentifier, + override val data: Poll +) : Update diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt index 097a200071..1ff2353d5a 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt @@ -7,6 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage 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.update.abstracts.Update import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField import kotlinx.serialization.* @@ -25,7 +26,8 @@ data class RawUpdate constructor( private val chosen_inline_result: RawChosenInlineResult? = null, private val callback_query: RawCallbackQuery? = null, private val shipping_query: ShippingQuery? = null, - private val pre_checkout_query: PreCheckoutQuery? = null + private val pre_checkout_query: PreCheckoutQuery? = null, + private val poll: Poll? = null ) { @Transient val asUpdate: Update by lazy { @@ -40,6 +42,7 @@ data class RawUpdate constructor( callback_query != null -> CallbackQueryUpdate(updateId, callback_query.asCallbackQuery) shipping_query != null -> ShippingQueryUpdate(updateId, shipping_query) pre_checkout_query != null -> PreCheckoutQueryUpdate(updateId, pre_checkout_query) + poll != null -> PollUpdate(updateId, poll) else -> throw IllegalArgumentException("Unsupported type of update") } }