mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +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
|
* `SendPoll` was rewritten as sealed class
|
||||||
* `SendRegularPoll` was created and represent `sendPoll` method with type `regular`
|
* `SendRegularPoll` was created and represent `sendPoll` method with type `regular`
|
||||||
* `SendQuizPoll` was created and represent `sendPoll` method with type `quiz`
|
* `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
|
* `Poll#createRequest` extension was added
|
||||||
* `PollAnswerUpdate` type of update 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
|
## 0.22.0
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ const val UPDATE_CALLBACK_QUERY = "callback_query"
|
|||||||
const val UPDATE_SHIPPING_QUERY = "shipping_query"
|
const val UPDATE_SHIPPING_QUERY = "shipping_query"
|
||||||
const val UPDATE_PRE_CHECKOUT_QUERY = "pre_checkout_query"
|
const val UPDATE_PRE_CHECKOUT_QUERY = "pre_checkout_query"
|
||||||
const val UPDATE_POLL = "poll"
|
const val UPDATE_POLL = "poll"
|
||||||
|
const val UPDATE_POLL_ANSWER = "poll_answer"
|
||||||
|
|
||||||
val ALL_UPDATES_LIST = listOf(
|
val ALL_UPDATES_LIST = listOf(
|
||||||
UPDATE_MESSAGE,
|
UPDATE_MESSAGE,
|
||||||
@ -21,5 +22,6 @@ val ALL_UPDATES_LIST = listOf(
|
|||||||
UPDATE_CALLBACK_QUERY,
|
UPDATE_CALLBACK_QUERY,
|
||||||
UPDATE_SHIPPING_QUERY,
|
UPDATE_SHIPPING_QUERY,
|
||||||
UPDATE_PRE_CHECKOUT_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 shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||||
private val preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
private val preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||||
private val pollUpdateCallback: UpdateReceiver<PollUpdate>? = null,
|
private val pollUpdateCallback: UpdateReceiver<PollUpdate>? = null,
|
||||||
|
private val pollAnswerUpdateCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||||
private val unknownUpdateTypeCallback: UpdateReceiver<UnknownUpdateType>? = null
|
private val unknownUpdateTypeCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||||
) {
|
) {
|
||||||
val asUpdateReceiver: UpdateReceiver<Update> = this::invoke
|
val asUpdateReceiver: UpdateReceiver<Update> = this::invoke
|
||||||
@ -35,7 +36,8 @@ data class UpdatesFilter(
|
|||||||
callbackQueryCallback ?.let { UPDATE_CALLBACK_QUERY },
|
callbackQueryCallback ?.let { UPDATE_CALLBACK_QUERY },
|
||||||
shippingQueryCallback ?.let { UPDATE_SHIPPING_QUERY },
|
shippingQueryCallback ?.let { UPDATE_SHIPPING_QUERY },
|
||||||
preCheckoutQueryCallback ?.let { UPDATE_PRE_CHECKOUT_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) {
|
suspend fun invoke(update: Update) {
|
||||||
@ -74,6 +76,7 @@ data class UpdatesFilter(
|
|||||||
is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update)
|
is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update)
|
||||||
is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update)
|
is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update)
|
||||||
is PollUpdate -> pollUpdateCallback ?.invoke(update)
|
is PollUpdate -> pollUpdateCallback ?.invoke(update)
|
||||||
|
is PollAnswerUpdate -> pollAnswerUpdateCallback ?.invoke(update)
|
||||||
is UnknownUpdateType -> unknownUpdateTypeCallback ?.invoke(update)
|
is UnknownUpdateType -> unknownUpdateTypeCallback ?.invoke(update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +94,7 @@ fun createSimpleUpdateFilter(
|
|||||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||||
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
||||||
|
pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||||
unknownCallback: UpdateReceiver<UnknownUpdateType>? = null
|
unknownCallback: UpdateReceiver<UnknownUpdateType>? = null
|
||||||
): UpdatesFilter = UpdatesFilter(
|
): UpdatesFilter = UpdatesFilter(
|
||||||
messageCallback = messageCallback,
|
messageCallback = messageCallback,
|
||||||
@ -107,5 +111,6 @@ fun createSimpleUpdateFilter(
|
|||||||
shippingQueryCallback = shippingQueryCallback,
|
shippingQueryCallback = shippingQueryCallback,
|
||||||
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
||||||
pollUpdateCallback = pollCallback,
|
pollUpdateCallback = pollCallback,
|
||||||
|
pollAnswerUpdateCallback = pollAnswerCallback,
|
||||||
unknownUpdateTypeCallback = unknownCallback
|
unknownUpdateTypeCallback = unknownCallback
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user