From d0b606469bf670abf0b1fda7120c3d6fc6ad4c37 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 11 Jul 2022 02:05:10 +0600 Subject: [PATCH] fixes related to owner chat member --- .../tgbotapi/extensions/utils/ClassCasts.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt index 09469564c3..a832b1aaf8 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt @@ -1828,13 +1828,25 @@ inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryR this as InlineQueryResultVoiceCommon @PreviewFeature -inline fun ChatMember.whenCreatorChatMember(block: (OwnerChatMember) -> T) = asCreatorChatMember() ?.let(block) +@Deprecated("Renamed", ReplaceWith("whenOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.whenOwnerChatMember")) +inline fun ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block) @PreviewFeature -inline fun ChatMember.asCreatorChatMember(): OwnerChatMember? = this as? OwnerChatMember +@Deprecated("Renamed", ReplaceWith("asOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.asOwnerChatMember")) +inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember @PreviewFeature -inline fun ChatMember.requireCreatorChatMember(): OwnerChatMember = this as OwnerChatMember +@Deprecated("Renamed", ReplaceWith("requireOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.requireOwnerChatMember")) +inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember + +@PreviewFeature +inline fun ChatMember.whenOwnerChatMember(block: (OwnerChatMember) -> T) = asOwnerChatMember() ?.let(block) + +@PreviewFeature +inline fun ChatMember.asOwnerChatMember(): OwnerChatMember? = this as? OwnerChatMember + +@PreviewFeature +inline fun ChatMember.requireOwnerChatMember(): OwnerChatMember = this as OwnerChatMember @PreviewFeature inline fun ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block)