mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +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
|
||||
fun Update.sourceChat(
|
||||
fun Update.sourceChatWithConverters(
|
||||
baseMessageUpdateConverter: (BaseMessageUpdate) -> Chat? = { it.data.chat },
|
||||
chatJoinRequestUpdateConverter: (ChatJoinRequestUpdate) -> Chat? = { it.data.chat },
|
||||
shippingQueryUpdateConverter: (ShippingQueryUpdate) -> Chat? = { it.data.from },
|
||||
pollAnswerUpdateConverter: (PollAnswerUpdate) -> Chat? = { it.data.from },
|
||||
shippingQueryUpdateConverter: (ShippingQueryUpdate) -> Chat? = { null },
|
||||
pollAnswerUpdateConverter: (PollAnswerUpdate) -> Chat? = { null },
|
||||
preCheckoutQueryUpdateConverter: (PreCheckoutQueryUpdate) -> Chat? = { it.data.from },
|
||||
callbackQueryUpdateConverter: (CallbackQueryUpdate) -> Chat? = { it.data.sourceChat() },
|
||||
chosenInlineResultUpdateConverter: (ChosenInlineResultUpdate) -> Chat? = { null },
|
||||
@ -66,6 +66,9 @@ fun Update.sourceChat(
|
||||
}
|
||||
}
|
||||
|
||||
@PreviewFeature
|
||||
fun Update.sourceChat(): Chat? = sourceChatWithConverters()
|
||||
|
||||
@PreviewFeature
|
||||
fun Update.sourceUser(): User? = when (val data = data) {
|
||||
is FromUser -> data.from
|
||||
|
Loading…
Reference in New Issue
Block a user