1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-17 19:55:49 +00:00

PossiblyReplyMessage casts

Add asPossiblyReplyMessage / requirePossiblyReplyMessage / whenPossiblyReplyMessage
This commit is contained in:
Siarhei
2021-10-16 23:01:10 +03:00
committed by madhead
parent ddd32a81c0
commit 4203a0fdfe
2 changed files with 13 additions and 0 deletions

View File

@@ -1132,6 +1132,15 @@ inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as?
@PreviewFeature
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
@PreviewFeature
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) = asPossiblyReplyMessage() ?.let(block)
@PreviewFeature
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
@PreviewFeature
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
@PreviewFeature
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) = asPossiblyForwardedMessage() ?.let(block)