mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
add backward compatibility change
This commit is contained in:
parent
67b7472868
commit
8247e7c69c
@ -25,11 +25,11 @@ fun CallbackQuery.sourceChat() = when (this) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
fun Update.sourceChat(
|
fun Update.sourceChatWithConverters(
|
||||||
baseMessageUpdateConverter: (BaseMessageUpdate) -> Chat? = { it.data.chat },
|
baseMessageUpdateConverter: (BaseMessageUpdate) -> Chat? = { it.data.chat },
|
||||||
chatJoinRequestUpdateConverter: (ChatJoinRequestUpdate) -> Chat? = { it.data.chat },
|
chatJoinRequestUpdateConverter: (ChatJoinRequestUpdate) -> Chat? = { it.data.chat },
|
||||||
shippingQueryUpdateConverter: (ShippingQueryUpdate) -> Chat? = { it.data.from },
|
shippingQueryUpdateConverter: (ShippingQueryUpdate) -> Chat? = { null },
|
||||||
pollAnswerUpdateConverter: (PollAnswerUpdate) -> Chat? = { it.data.from },
|
pollAnswerUpdateConverter: (PollAnswerUpdate) -> Chat? = { null },
|
||||||
preCheckoutQueryUpdateConverter: (PreCheckoutQueryUpdate) -> Chat? = { it.data.from },
|
preCheckoutQueryUpdateConverter: (PreCheckoutQueryUpdate) -> Chat? = { it.data.from },
|
||||||
callbackQueryUpdateConverter: (CallbackQueryUpdate) -> Chat? = { it.data.sourceChat() },
|
callbackQueryUpdateConverter: (CallbackQueryUpdate) -> Chat? = { it.data.sourceChat() },
|
||||||
chosenInlineResultUpdateConverter: (ChosenInlineResultUpdate) -> Chat? = { null },
|
chosenInlineResultUpdateConverter: (ChosenInlineResultUpdate) -> Chat? = { null },
|
||||||
@ -66,6 +66,9 @@ fun Update.sourceChat(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreviewFeature
|
||||||
|
fun Update.sourceChat(): Chat? = sourceChatWithConverters()
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
fun Update.sourceUser(): User? = when (val data = data) {
|
fun Update.sourceUser(): User? = when (val data = data) {
|
||||||
is FromUser -> data.from
|
is FromUser -> data.from
|
||||||
|
Loading…
Reference in New Issue
Block a user