mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add PollUpdate
This commit is contained in:
parent
b7d214d145
commit
457cadf265
@ -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
|
||||
|
||||
|
@ -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
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user