mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
UpdatesFilter now support PollAnswerUpdate
This commit is contained in:
parent
7aef76f432
commit
dbd9c72249
@ -9,10 +9,11 @@
|
||||
* `SendPoll` was rewritten as sealed class
|
||||
* `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
|
||||
* `Poll#createRequest` extension was added
|
||||
* `PollAnswerUpdate` type of update was added
|
||||
* `PollAnswer` type was added
|
||||
* `UpdatesFilter` now support work with `PollAnswerUpdate`
|
||||
* `language` field in PreTextSource now correctly passed from telegram MessageEntities
|
||||
|
||||
## 0.22.0
|
||||
|
||||
|
@ -10,6 +10,7 @@ const val UPDATE_CALLBACK_QUERY = "callback_query"
|
||||
const val UPDATE_SHIPPING_QUERY = "shipping_query"
|
||||
const val UPDATE_PRE_CHECKOUT_QUERY = "pre_checkout_query"
|
||||
const val UPDATE_POLL = "poll"
|
||||
const val UPDATE_POLL_ANSWER = "poll_answer"
|
||||
|
||||
val ALL_UPDATES_LIST = listOf(
|
||||
UPDATE_MESSAGE,
|
||||
@ -21,5 +22,6 @@ val ALL_UPDATES_LIST = listOf(
|
||||
UPDATE_CALLBACK_QUERY,
|
||||
UPDATE_SHIPPING_QUERY,
|
||||
UPDATE_PRE_CHECKOUT_QUERY,
|
||||
UPDATE_POLL
|
||||
UPDATE_POLL,
|
||||
UPDATE_POLL_ANSWER
|
||||
)
|
||||
|
@ -22,6 +22,7 @@ data class UpdatesFilter(
|
||||
private val shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||
private val preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||
private val pollUpdateCallback: UpdateReceiver<PollUpdate>? = null,
|
||||
private val pollAnswerUpdateCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||
private val unknownUpdateTypeCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||
) {
|
||||
val asUpdateReceiver: UpdateReceiver<Update> = this::invoke
|
||||
@ -35,7 +36,8 @@ data class UpdatesFilter(
|
||||
callbackQueryCallback ?.let { UPDATE_CALLBACK_QUERY },
|
||||
shippingQueryCallback ?.let { UPDATE_SHIPPING_QUERY },
|
||||
preCheckoutQueryCallback ?.let { UPDATE_PRE_CHECKOUT_QUERY },
|
||||
pollUpdateCallback ?.let { UPDATE_POLL }
|
||||
pollUpdateCallback ?.let { UPDATE_POLL },
|
||||
pollAnswerUpdateCallback ?.let { UPDATE_POLL_ANSWER }
|
||||
)
|
||||
|
||||
suspend fun invoke(update: Update) {
|
||||
@ -74,6 +76,7 @@ data class UpdatesFilter(
|
||||
is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update)
|
||||
is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update)
|
||||
is PollUpdate -> pollUpdateCallback ?.invoke(update)
|
||||
is PollAnswerUpdate -> pollAnswerUpdateCallback ?.invoke(update)
|
||||
is UnknownUpdateType -> unknownUpdateTypeCallback ?.invoke(update)
|
||||
}
|
||||
}
|
||||
@ -91,6 +94,7 @@ fun createSimpleUpdateFilter(
|
||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
||||
pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||
unknownCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||
): UpdatesFilter = UpdatesFilter(
|
||||
messageCallback = messageCallback,
|
||||
@ -107,5 +111,6 @@ fun createSimpleUpdateFilter(
|
||||
shippingQueryCallback = shippingQueryCallback,
|
||||
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
||||
pollUpdateCallback = pollCallback,
|
||||
pollAnswerUpdateCallback = pollAnswerCallback,
|
||||
unknownUpdateTypeCallback = unknownCallback
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user