mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-19 20:55:53 +00:00
classcasts fill for WithOptionalLanguageCode
This commit is contained in:
@@ -23,6 +23,8 @@ import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.query.*
|
||||
import dev.inmo.tgbotapi.types.InputMedia.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithLanguageCode
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.actions.*
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
@@ -3106,3 +3108,21 @@ inline fun Any.asFromUser(): FromUser? = this as? FromUser
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Any.requireFromUser(): FromUser = this as FromUser
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Any.whenWithOptionalLanguageCode(block: (WithOptionalLanguageCode) -> T) = asWithOptionalLanguageCode() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Any.asWithOptionalLanguageCode(): WithOptionalLanguageCode? = this as? WithOptionalLanguageCode
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Any.requireWithOptionalLanguageCode(): WithOptionalLanguageCode = this as WithOptionalLanguageCode
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> Any.whenWithLanguageCode(block: (WithLanguageCode) -> T) = asWithLanguageCode() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Any.asWithLanguageCode(): WithLanguageCode? = this as? WithLanguageCode
|
||||
|
||||
@PreviewFeature
|
||||
inline fun Any.requireWithLanguageCode(): WithLanguageCode = this as WithLanguageCode
|
||||
|
||||
Reference in New Issue
Block a user