1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

Merge pull request #766 from InsanusMokrassar/8.1.0

8.1.0
This commit is contained in:
InsanusMokrassar 2023-06-19 22:48:50 +06:00 committed by GitHub
commit 6f512a144c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 86 additions and 470 deletions

View File

@ -1,5 +1,15 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 8.1.0
**PARTIALLY BREAKING CHANGES: Exclude `.*Impl` classcasts from `ClassCastsNew`**
* `Version`:
* `MicroUtils`: `0.19.2` -> `0.19.4`
* `Utils`:
* Add deep links formatting for internal `tg://` prefix (thanks to [@klimatov](https://github.com/klimatov))
* Exclude `.*Impl` classcasts from `ClassCastsNew`
## 8.0.1 ## 8.0.1
* `Version`: * `Version`:

View File

@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
library_group=dev.inmo library_group=dev.inmo
library_version=8.0.1 library_version=8.1.0

View File

@ -1,6 +1,6 @@
[versions] [versions]
kotlin = "1.8.21" kotlin = "1.8.22"
kotlin-serialization = "1.5.1" kotlin-serialization = "1.5.1"
kotlin-coroutines = "1.6.4" kotlin-coroutines = "1.6.4"
@ -10,10 +10,10 @@ korlibs = "4.0.3"
uuid = "0.7.1" uuid = "0.7.1"
ktor = "2.3.1" ktor = "2.3.1"
ksp = "1.8.21-1.0.11" ksp = "1.8.22-1.0.11"
kotlin-poet = "1.14.2" kotlin-poet = "1.14.2"
microutils = "0.19.2" microutils = "0.19.4"
github-release-plugin = "2.4.1" github-release-plugin = "2.4.1"
dokka = "1.8.20" dokka = "1.8.20"

View File

@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.User
* *
* @see FromUser * @see FromUser
*/ */
@ClassCastsIncluded @ClassCastsIncluded(excludeRegex = ".*Impl")
interface WithUser { interface WithUser {
val user: User val user: User
} }

View File

@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable(InlineQueryResultSerializer::class) @Serializable(InlineQueryResultSerializer::class)
@ClassCastsIncluded @ClassCastsIncluded(excludeRegex = ".*Impl")
interface InlineQueryResult { interface InlineQueryResult {
val type: String val type: String
val id: InlineQueryIdentifier val id: InlineQueryIdentifier

View File

@ -49,7 +49,7 @@ sealed interface AbleToAddInAttachmentMenuChat : Chat {
} }
@Serializable(PreviewChatSerializer::class) @Serializable(PreviewChatSerializer::class)
@ClassCastsIncluded @ClassCastsIncluded(excludeRegex = ".*Impl")
sealed interface Chat { sealed interface Chat {
val id: IdChatIdentifier val id: IdChatIdentifier
} }

View File

@ -3,11 +3,13 @@ package dev.inmo.tgbotapi.types.chat
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ExtendedChannelChat due")
data class ExtendedChannelChatImpl( data class ExtendedChannelChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,
@ -33,6 +35,7 @@ data class ExtendedChannelChatImpl(
) : ExtendedChannelChat ) : ExtendedChannelChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ExtendedGroupChat due")
data class ExtendedGroupChatImpl( data class ExtendedGroupChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,
@ -54,6 +57,7 @@ data class ExtendedGroupChatImpl(
) : ExtendedGroupChat ) : ExtendedGroupChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ExtendedPrivateChat due")
data class ExtendedPrivateChatImpl( data class ExtendedPrivateChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: UserId, override val id: UserId,
@ -80,6 +84,7 @@ data class ExtendedPrivateChatImpl(
typealias ExtendedUser = ExtendedPrivateChatImpl typealias ExtendedUser = ExtendedPrivateChatImpl
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ExtendedSupergroupChat due")
data class ExtendedSupergroupChatImpl( data class ExtendedSupergroupChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,
@ -121,6 +126,7 @@ data class ExtendedSupergroupChatImpl(
) : ExtendedSupergroupChat ) : ExtendedSupergroupChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ExtendedForumChat due")
data class ExtendedForumChatImpl( data class ExtendedForumChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: IdChatIdentifier, override val id: IdChatIdentifier,

View File

@ -4,10 +4,12 @@ import dev.inmo.micro_utils.language_codes.IetfLanguageCode
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use GroupChat due")
data class GroupChatImpl( data class GroupChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,
@ -16,6 +18,7 @@ data class GroupChatImpl(
) : GroupChat ) : GroupChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use PrivateChat due")
data class PrivateChatImpl( data class PrivateChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: UserId, override val id: UserId,
@ -28,6 +31,7 @@ data class PrivateChatImpl(
) : PrivateChat ) : PrivateChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use SupergroupChat due")
data class SupergroupChatImpl( data class SupergroupChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,
@ -38,6 +42,7 @@ data class SupergroupChatImpl(
) : SupergroupChat ) : SupergroupChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ForumChat due")
data class ForumChatImpl( data class ForumChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: IdChatIdentifier, override val id: IdChatIdentifier,
@ -48,6 +53,7 @@ data class ForumChatImpl(
) : ForumChat ) : ForumChat
@Serializable @Serializable
@RiskFeature("This class is a subject of changes. It is better to use ChannelChat due")
data class ChannelChatImpl( data class ChannelChatImpl(
@SerialName(idField) @SerialName(idField)
override val id: ChatId, override val id: ChatId,

View File

@ -11,7 +11,7 @@ import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.Encoder
@ClassCastsIncluded @ClassCastsIncluded(excludeRegex = ".*Impl")
interface Message : WithChat { interface Message : WithChat {
val messageId: MessageId val messageId: MessageId
val date: DateTime val date: DateTime

View File

@ -1,5 +1,13 @@
package dev.inmo.tgbotapi.utils.internal package dev.inmo.tgbotapi.utils.internal
import dev.inmo.tgbotapi.utils.RiskFeature
@Target(AnnotationTarget.CLASS) @Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
internal annotation class ClassCastsIncluded @RiskFeature("It is internal API in tgbotapi.core and should not be used outside")
annotation class ClassCastsIncluded(val typesRegex: String = "", val excludeRegex: String = "")
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
@RiskFeature("It is internal API in tgbotapi.core and should not be used outside")
annotation class ClassCastsExcluded

View File

@ -9,4 +9,5 @@ repositories {
dependencies { dependencies {
implementation libs.kotlin.poet implementation libs.kotlin.poet
implementation libs.ksp implementation libs.ksp
implementation project(":tgbotapi.core")
} }

View File

@ -1,12 +1,21 @@
package dev.inmo.tgbotapi.ksp.processor package dev.inmo.tgbotapi.ksp.processor
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.getAllSuperTypes import com.google.devtools.ksp.getAllSuperTypes
import com.google.devtools.ksp.getAnnotationsByType
import com.google.devtools.ksp.isAnnotationPresent
import com.google.devtools.ksp.processing.* import com.google.devtools.ksp.processing.*
import com.google.devtools.ksp.symbol.KSAnnotated import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.symbol.KSClassDeclaration import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.squareup.kotlinpoet.AnnotationSpec import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FileSpec
import com.squareup.kotlinpoet.asClassName
import com.squareup.kotlinpoet.ksp.toClassName
import com.squareup.kotlinpoet.ksp.writeTo import com.squareup.kotlinpoet.ksp.writeTo
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import java.io.File import java.io.File
class TelegramBotAPISymbolProcessor( class TelegramBotAPISymbolProcessor(
@ -15,24 +24,51 @@ class TelegramBotAPISymbolProcessor(
private val outputFile: String = "Output", private val outputFile: String = "Output",
private val outputFolder: String? = null private val outputFolder: String? = null
) : SymbolProcessor { ) : SymbolProcessor {
private val classCastsIncludedClassName = ClassCastsIncluded::class.asClassName()
@OptIn(KspExperimental::class, RiskFeature::class)
override fun process(resolver: Resolver): List<KSAnnotated> { override fun process(resolver: Resolver): List<KSAnnotated> {
val classes = resolver.getSymbolsWithAnnotation("dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded").filterIsInstance<KSClassDeclaration>() val classes = resolver.getSymbolsWithAnnotation(classCastsIncludedClassName.canonicalName).filterIsInstance<KSClassDeclaration>()
val classesRegexes: Map<KSClassDeclaration, Pair<Regex?, Regex?>> = classes.mapNotNull {
it to (it.getAnnotationsByType(ClassCastsIncluded::class).firstNotNullOfOrNull {
it.typesRegex.takeIf { it.isNotEmpty() } ?.let(::Regex) to it.excludeRegex.takeIf { it.isNotEmpty() } ?.let(::Regex)
} ?: return@mapNotNull null)
}.toMap()
val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>() val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>()
resolver.getAllFiles().forEach { resolver.getAllFiles().forEach {
it.declarations.forEach { potentialSubtype -> it.declarations.forEach { potentialSubtype ->
if (potentialSubtype is KSClassDeclaration) { if (
potentialSubtype is KSClassDeclaration
&& potentialSubtype.isAnnotationPresent(ClassCastsExcluded::class).not()
) {
val allSupertypes = potentialSubtype.getAllSuperTypes().map { it.declaration } val allSupertypes = potentialSubtype.getAllSuperTypes().map { it.declaration }
classes.forEach {
if (it in allSupertypes) { for (currentClass in classes) {
classesSubtypes.getOrPut(it) { mutableSetOf() }.add(potentialSubtype) val regexes = classesRegexes[currentClass]
val simpleName = potentialSubtype.simpleName.getShortName()
when {
currentClass !in allSupertypes
|| regexes ?.first ?.matches(simpleName) == false
|| regexes ?.second ?.matches(simpleName) == true -> continue
else -> {
classesSubtypes.getOrPut(currentClass) { mutableSetOf() }.add(potentialSubtype)
}
} }
} }
} }
} }
} }
fun fillWithSealeds(source: KSClassDeclaration, current: KSClassDeclaration = source) { fun fillWithSealeds(source: KSClassDeclaration, current: KSClassDeclaration = source) {
val regexes = classesRegexes[source]
current.getSealedSubclasses().forEach { current.getSealedSubclasses().forEach {
val simpleName = it.simpleName.getShortName()
if (
regexes ?.first ?.matches(simpleName) == false
|| regexes ?.second ?.matches(simpleName) == true
|| it.isAnnotationPresent(ClassCastsExcluded::class)
) {
return@forEach
}
classesSubtypes.getOrPut(source) { mutableSetOf() }.add(it) classesSubtypes.getOrPut(source) { mutableSetOf() }.add(it)
fillWithSealeds(source, it) fillWithSealeds(source, it)
} }

View File

@ -28,25 +28,11 @@ import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInline
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
@ -124,50 +110,37 @@ import dev.inmo.tgbotapi.types.buttons.ReplyKeyboardRemove
import dev.inmo.tgbotapi.types.chat.AbleToAddInAttachmentMenuChat import dev.inmo.tgbotapi.types.chat.AbleToAddInAttachmentMenuChat
import dev.inmo.tgbotapi.types.chat.Bot import dev.inmo.tgbotapi.types.chat.Bot
import dev.inmo.tgbotapi.types.chat.ChannelChat import dev.inmo.tgbotapi.types.chat.ChannelChat
import dev.inmo.tgbotapi.types.chat.ChannelChatImpl
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.chat.CommonBot import dev.inmo.tgbotapi.types.chat.CommonBot
import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.chat.ExtendedBot import dev.inmo.tgbotapi.types.chat.ExtendedBot
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedChat import dev.inmo.tgbotapi.types.chat.ExtendedChat
import dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername import dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername
import dev.inmo.tgbotapi.types.chat.ExtendedForumChat import dev.inmo.tgbotapi.types.chat.ExtendedForumChat
import dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
import dev.inmo.tgbotapi.types.chat.ForumChat import dev.inmo.tgbotapi.types.chat.ForumChat
import dev.inmo.tgbotapi.types.chat.ForumChatImpl
import dev.inmo.tgbotapi.types.chat.GroupChat import dev.inmo.tgbotapi.types.chat.GroupChat
import dev.inmo.tgbotapi.types.chat.GroupChatImpl
import dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat import dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat
import dev.inmo.tgbotapi.types.chat.PrivateChat import dev.inmo.tgbotapi.types.chat.PrivateChat
import dev.inmo.tgbotapi.types.chat.PrivateChatImpl
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.SuperPublicChat import dev.inmo.tgbotapi.types.chat.SuperPublicChat
import dev.inmo.tgbotapi.types.chat.SupergroupChat import dev.inmo.tgbotapi.types.chat.SupergroupChat
import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
import dev.inmo.tgbotapi.types.chat.UnknownChatType import dev.inmo.tgbotapi.types.chat.UnknownChatType
import dev.inmo.tgbotapi.types.chat.UnknownExtendedChat import dev.inmo.tgbotapi.types.chat.UnknownExtendedChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.chat.UsernameChat import dev.inmo.tgbotapi.types.chat.UsernameChat
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
import dev.inmo.tgbotapi.types.chat.member.BannedChatMember import dev.inmo.tgbotapi.types.chat.member.BannedChatMember
import dev.inmo.tgbotapi.types.chat.member.ChatMember import dev.inmo.tgbotapi.types.chat.member.ChatMember
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
import dev.inmo.tgbotapi.types.chat.member.KickedChatMember import dev.inmo.tgbotapi.types.chat.member.KickedChatMember
import dev.inmo.tgbotapi.types.chat.member.LeftChatMember import dev.inmo.tgbotapi.types.chat.member.LeftChatMember
import dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
import dev.inmo.tgbotapi.types.chat.member.MemberChatMember import dev.inmo.tgbotapi.types.chat.member.MemberChatMember
import dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
import dev.inmo.tgbotapi.types.chat.member.OwnerChatMember import dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
import dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember import dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember
import dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember import dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember
@ -228,9 +201,6 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
import dev.inmo.tgbotapi.types.media.TitledTelegramMedia import dev.inmo.tgbotapi.types.media.TitledTelegramMedia
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
import dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl
import dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl
import dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl
import dev.inmo.tgbotapi.types.message.ChannelEventMessage import dev.inmo.tgbotapi.types.message.ChannelEventMessage
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
@ -266,17 +236,11 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted
import dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl
import dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl
import dev.inmo.tgbotapi.types.message.CommonGroupEventMessage import dev.inmo.tgbotapi.types.message.CommonGroupEventMessage
import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage
import dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl
import dev.inmo.tgbotapi.types.message.ForwardInfo import dev.inmo.tgbotapi.types.message.ForwardInfo
import dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl
import dev.inmo.tgbotapi.types.message.PassportMessage import dev.inmo.tgbotapi.types.message.PassportMessage
import dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl
import dev.inmo.tgbotapi.types.message.PrivateEventMessage import dev.inmo.tgbotapi.types.message.PrivateEventMessage
import dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
@ -635,16 +599,6 @@ public inline fun WithUser.administratorChatMemberOrThrow(): AdministratorChatMe
public inline fun <T> WithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T? public inline fun <T> WithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T?
= administratorChatMemberOrNull() ?.let(block) = administratorChatMemberOrNull() ?.let(block)
public inline fun WithUser.administratorChatMemberImplOrNull(): AdministratorChatMemberImpl? = this
as? dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
public inline fun WithUser.administratorChatMemberImplOrThrow(): AdministratorChatMemberImpl = this
as dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
public inline fun <T>
WithUser.ifAdministratorChatMemberImpl(block: (AdministratorChatMemberImpl) -> T): T? =
administratorChatMemberImplOrNull() ?.let(block)
public inline fun WithUser.bannedChatMemberOrNull(): BannedChatMember? = this as? public inline fun WithUser.bannedChatMemberOrNull(): BannedChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.BannedChatMember dev.inmo.tgbotapi.types.chat.member.BannedChatMember
@ -690,15 +644,6 @@ public inline fun WithUser.leftChatMemberOrThrow(): LeftChatMember = this as
public inline fun <T> WithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? = public inline fun <T> WithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? =
leftChatMemberOrNull() ?.let(block) leftChatMemberOrNull() ?.let(block)
public inline fun WithUser.leftChatMemberImplOrNull(): LeftChatMemberImpl? = this as?
dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
public inline fun WithUser.leftChatMemberImplOrThrow(): LeftChatMemberImpl = this as
dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
public inline fun <T> WithUser.ifLeftChatMemberImpl(block: (LeftChatMemberImpl) -> T): T? =
leftChatMemberImplOrNull() ?.let(block)
public inline fun WithUser.memberChatMemberOrNull(): MemberChatMember? = this as? public inline fun WithUser.memberChatMemberOrNull(): MemberChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.MemberChatMember dev.inmo.tgbotapi.types.chat.member.MemberChatMember
@ -708,15 +653,6 @@ public inline fun WithUser.memberChatMemberOrThrow(): MemberChatMember = this as
public inline fun <T> WithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? = public inline fun <T> WithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? =
memberChatMemberOrNull() ?.let(block) memberChatMemberOrNull() ?.let(block)
public inline fun WithUser.memberChatMemberImplOrNull(): MemberChatMemberImpl? = this as?
dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
public inline fun WithUser.memberChatMemberImplOrThrow(): MemberChatMemberImpl = this as
dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
public inline fun <T> WithUser.ifMemberChatMemberImpl(block: (MemberChatMemberImpl) -> T): T? =
memberChatMemberImplOrNull() ?.let(block)
public inline fun WithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as? public inline fun WithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as?
dev.inmo.tgbotapi.types.chat.member.OwnerChatMember dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
@ -777,30 +713,6 @@ public inline fun <T>
WithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T): WithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
T? = commonSupergroupEventMessageOrNull() ?.let(block) T? = commonSupergroupEventMessageOrNull() ?.let(block)
public inline fun WithUser.commonGroupContentMessageImplOrNull():
CommonGroupContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.commonGroupContentMessageImplOrThrow():
CommonGroupContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
WithUser.ifCommonGroupContentMessageImpl(block: (CommonGroupContentMessageImpl<MessageContent>) -> T):
T? = commonGroupContentMessageImplOrNull() ?.let(block)
public inline fun WithUser.commonForumContentMessageImplOrNull():
CommonForumContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.commonForumContentMessageImplOrThrow():
CommonForumContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
WithUser.ifCommonForumContentMessageImpl(block: (CommonForumContentMessageImpl<MessageContent>) -> T):
T? = commonForumContentMessageImplOrNull() ?.let(block)
public inline fun WithUser.passportMessageOrNull(): PassportMessage? = this as? public inline fun WithUser.passportMessageOrNull(): PassportMessage? = this as?
dev.inmo.tgbotapi.types.message.PassportMessage dev.inmo.tgbotapi.types.message.PassportMessage
@ -810,18 +722,6 @@ public inline fun WithUser.passportMessageOrThrow(): PassportMessage = this as
public inline fun <T> WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? = public inline fun <T> WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? =
passportMessageOrNull() ?.let(block) passportMessageOrNull() ?.let(block)
public inline fun WithUser.privateContentMessageImplOrNull():
PrivateContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun WithUser.privateContentMessageImplOrThrow():
PrivateContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
WithUser.ifPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T):
T? = privateContentMessageImplOrNull() ?.let(block)
public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as? public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as?
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
@ -1127,28 +1027,6 @@ public inline fun <T>
InlineQueryResult.ifInlineQueryResultArticle(block: (InlineQueryResultArticle) -> T): T? = InlineQueryResult.ifInlineQueryResultArticle(block: (InlineQueryResultArticle) -> T): T? =
inlineQueryResultArticleOrNull() ?.let(block) inlineQueryResultArticleOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultAudioCachedImplOrNull():
InlineQueryResultAudioCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
public inline fun InlineQueryResult.inlineQueryResultAudioCachedImplOrThrow():
InlineQueryResultAudioCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultAudioCachedImpl(block: (InlineQueryResultAudioCachedImpl) -> T):
T? = inlineQueryResultAudioCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultAudioImplOrNull(): InlineQueryResultAudioImpl?
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
public inline fun InlineQueryResult.inlineQueryResultAudioImplOrThrow(): InlineQueryResultAudioImpl
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultAudioImpl(block: (InlineQueryResultAudioImpl) -> T): T? =
inlineQueryResultAudioImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultContactOrNull(): InlineQueryResultContact? = public inline fun InlineQueryResult.inlineQueryResultContactOrNull(): InlineQueryResultContact? =
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact
@ -1159,30 +1037,6 @@ public inline fun <T>
InlineQueryResult.ifInlineQueryResultContact(block: (InlineQueryResultContact) -> T): T? = InlineQueryResult.ifInlineQueryResultContact(block: (InlineQueryResultContact) -> T): T? =
inlineQueryResultContactOrNull() ?.let(block) inlineQueryResultContactOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultDocumentCachedImplOrNull():
InlineQueryResultDocumentCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
public inline fun InlineQueryResult.inlineQueryResultDocumentCachedImplOrThrow():
InlineQueryResultDocumentCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultDocumentCachedImpl(block: (InlineQueryResultDocumentCachedImpl) -> T):
T? = inlineQueryResultDocumentCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultDocumentImplOrNull():
InlineQueryResultDocumentImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
public inline fun InlineQueryResult.inlineQueryResultDocumentImplOrThrow():
InlineQueryResultDocumentImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultDocumentImpl(block: (InlineQueryResultDocumentImpl) -> T):
T? = inlineQueryResultDocumentImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultGameOrNull(): InlineQueryResultGame? = this as? public inline fun InlineQueryResult.inlineQueryResultGameOrNull(): InlineQueryResultGame? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame
@ -1193,28 +1047,6 @@ public inline fun <T>
InlineQueryResult.ifInlineQueryResultGame(block: (InlineQueryResultGame) -> T): T? = InlineQueryResult.ifInlineQueryResultGame(block: (InlineQueryResultGame) -> T): T? =
inlineQueryResultGameOrNull() ?.let(block) inlineQueryResultGameOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultGifCachedImplOrNull():
InlineQueryResultGifCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
public inline fun InlineQueryResult.inlineQueryResultGifCachedImplOrThrow():
InlineQueryResultGifCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultGifCachedImpl(block: (InlineQueryResultGifCachedImpl) -> T):
T? = inlineQueryResultGifCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultGifImplOrNull(): InlineQueryResultGifImpl? =
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
public inline fun InlineQueryResult.inlineQueryResultGifImplOrThrow(): InlineQueryResultGifImpl =
this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultGifImpl(block: (InlineQueryResultGifImpl) -> T): T? =
inlineQueryResultGifImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultLocationOrNull(): InlineQueryResultLocation? = public inline fun InlineQueryResult.inlineQueryResultLocationOrNull(): InlineQueryResultLocation? =
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation
@ -1225,52 +1057,6 @@ public inline fun <T>
InlineQueryResult.ifInlineQueryResultLocation(block: (InlineQueryResultLocation) -> T): T? = InlineQueryResult.ifInlineQueryResultLocation(block: (InlineQueryResultLocation) -> T): T? =
inlineQueryResultLocationOrNull() ?.let(block) inlineQueryResultLocationOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedImplOrNull():
InlineQueryResultMpeg4GifCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedImplOrThrow():
InlineQueryResultMpeg4GifCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultMpeg4GifCachedImpl(block: (InlineQueryResultMpeg4GifCachedImpl) -> T):
T? = inlineQueryResultMpeg4GifCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifImplOrNull():
InlineQueryResultMpeg4GifImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifImplOrThrow():
InlineQueryResultMpeg4GifImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultMpeg4GifImpl(block: (InlineQueryResultMpeg4GifImpl) -> T):
T? = inlineQueryResultMpeg4GifImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultPhotoCachedImplOrNull():
InlineQueryResultPhotoCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
public inline fun InlineQueryResult.inlineQueryResultPhotoCachedImplOrThrow():
InlineQueryResultPhotoCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultPhotoCachedImpl(block: (InlineQueryResultPhotoCachedImpl) -> T):
T? = inlineQueryResultPhotoCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultPhotoImplOrNull(): InlineQueryResultPhotoImpl?
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
public inline fun InlineQueryResult.inlineQueryResultPhotoImplOrThrow(): InlineQueryResultPhotoImpl
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultPhotoImpl(block: (InlineQueryResultPhotoImpl) -> T): T? =
inlineQueryResultPhotoImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultStickerCachedOrNull(): public inline fun InlineQueryResult.inlineQueryResultStickerCachedOrNull():
InlineQueryResultStickerCached? = this as? InlineQueryResultStickerCached? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached
@ -1293,50 +1079,6 @@ public inline fun <T>
InlineQueryResult.ifInlineQueryResultVenue(block: (InlineQueryResultVenue) -> T): T? = InlineQueryResult.ifInlineQueryResultVenue(block: (InlineQueryResultVenue) -> T): T? =
inlineQueryResultVenueOrNull() ?.let(block) inlineQueryResultVenueOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultVideoCachedImplOrNull():
InlineQueryResultVideoCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
public inline fun InlineQueryResult.inlineQueryResultVideoCachedImplOrThrow():
InlineQueryResultVideoCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultVideoCachedImpl(block: (InlineQueryResultVideoCachedImpl) -> T):
T? = inlineQueryResultVideoCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultVideoImplOrNull(): InlineQueryResultVideoImpl?
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
public inline fun InlineQueryResult.inlineQueryResultVideoImplOrThrow(): InlineQueryResultVideoImpl
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultVideoImpl(block: (InlineQueryResultVideoImpl) -> T): T? =
inlineQueryResultVideoImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultVoiceCachedImplOrNull():
InlineQueryResultVoiceCachedImpl? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
public inline fun InlineQueryResult.inlineQueryResultVoiceCachedImplOrThrow():
InlineQueryResultVoiceCachedImpl = this as
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultVoiceCachedImpl(block: (InlineQueryResultVoiceCachedImpl) -> T):
T? = inlineQueryResultVoiceCachedImplOrNull() ?.let(block)
public inline fun InlineQueryResult.inlineQueryResultVoiceImplOrNull(): InlineQueryResultVoiceImpl?
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
public inline fun InlineQueryResult.inlineQueryResultVoiceImplOrThrow(): InlineQueryResultVoiceImpl
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
public inline fun <T>
InlineQueryResult.ifInlineQueryResultVoiceImpl(block: (InlineQueryResultVoiceImpl) -> T): T? =
inlineQueryResultVoiceImplOrNull() ?.let(block)
public inline fun InlineQueryResult.describedInlineQueryResultOrNull(): DescribedInlineQueryResult? public inline fun InlineQueryResult.describedInlineQueryResultOrNull(): DescribedInlineQueryResult?
= this as? = this as?
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult
@ -2130,51 +1872,6 @@ public inline fun <T>
Chat.ifAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T): T? = Chat.ifAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T): T? =
ableToAddInAttachmentMenuChatOrNull() ?.let(block) ableToAddInAttachmentMenuChatOrNull() ?.let(block)
public inline fun Chat.extendedChannelChatImplOrNull(): ExtendedChannelChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
public inline fun Chat.extendedChannelChatImplOrThrow(): ExtendedChannelChatImpl = this as
dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
public inline fun <T> Chat.ifExtendedChannelChatImpl(block: (ExtendedChannelChatImpl) -> T): T? =
extendedChannelChatImplOrNull() ?.let(block)
public inline fun Chat.extendedGroupChatImplOrNull(): ExtendedGroupChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
public inline fun Chat.extendedGroupChatImplOrThrow(): ExtendedGroupChatImpl = this as
dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
public inline fun <T> Chat.ifExtendedGroupChatImpl(block: (ExtendedGroupChatImpl) -> T): T? =
extendedGroupChatImplOrNull() ?.let(block)
public inline fun Chat.extendedPrivateChatImplOrNull(): ExtendedPrivateChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
public inline fun Chat.extendedPrivateChatImplOrThrow(): ExtendedPrivateChatImpl = this as
dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
public inline fun <T> Chat.ifExtendedPrivateChatImpl(block: (ExtendedPrivateChatImpl) -> T): T? =
extendedPrivateChatImplOrNull() ?.let(block)
public inline fun Chat.extendedSupergroupChatImplOrNull(): ExtendedSupergroupChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
public inline fun Chat.extendedSupergroupChatImplOrThrow(): ExtendedSupergroupChatImpl = this as
dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
public inline fun <T> Chat.ifExtendedSupergroupChatImpl(block: (ExtendedSupergroupChatImpl) -> T):
T? = extendedSupergroupChatImplOrNull() ?.let(block)
public inline fun Chat.extendedForumChatImplOrNull(): ExtendedForumChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
public inline fun Chat.extendedForumChatImplOrThrow(): ExtendedForumChatImpl = this as
dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
public inline fun <T> Chat.ifExtendedForumChatImpl(block: (ExtendedForumChatImpl) -> T): T? =
extendedForumChatImplOrNull() ?.let(block)
public inline fun Chat.extendedBotOrNull(): ExtendedBot? = this as? public inline fun Chat.extendedBotOrNull(): ExtendedBot? = this as?
dev.inmo.tgbotapi.types.chat.ExtendedBot dev.inmo.tgbotapi.types.chat.ExtendedBot
@ -2265,51 +1962,6 @@ public inline fun Chat.extendedChatWithUsernameOrThrow(): ExtendedChatWithUserna
public inline fun <T> Chat.ifExtendedChatWithUsername(block: (ExtendedChatWithUsername) -> T): T? = public inline fun <T> Chat.ifExtendedChatWithUsername(block: (ExtendedChatWithUsername) -> T): T? =
extendedChatWithUsernameOrNull() ?.let(block) extendedChatWithUsernameOrNull() ?.let(block)
public inline fun Chat.groupChatImplOrNull(): GroupChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.GroupChatImpl
public inline fun Chat.groupChatImplOrThrow(): GroupChatImpl = this as
dev.inmo.tgbotapi.types.chat.GroupChatImpl
public inline fun <T> Chat.ifGroupChatImpl(block: (GroupChatImpl) -> T): T? = groupChatImplOrNull()
?.let(block)
public inline fun Chat.privateChatImplOrNull(): PrivateChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.PrivateChatImpl
public inline fun Chat.privateChatImplOrThrow(): PrivateChatImpl = this as
dev.inmo.tgbotapi.types.chat.PrivateChatImpl
public inline fun <T> Chat.ifPrivateChatImpl(block: (PrivateChatImpl) -> T): T? =
privateChatImplOrNull() ?.let(block)
public inline fun Chat.supergroupChatImplOrNull(): SupergroupChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
public inline fun Chat.supergroupChatImplOrThrow(): SupergroupChatImpl = this as
dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
public inline fun <T> Chat.ifSupergroupChatImpl(block: (SupergroupChatImpl) -> T): T? =
supergroupChatImplOrNull() ?.let(block)
public inline fun Chat.forumChatImplOrNull(): ForumChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ForumChatImpl
public inline fun Chat.forumChatImplOrThrow(): ForumChatImpl = this as
dev.inmo.tgbotapi.types.chat.ForumChatImpl
public inline fun <T> Chat.ifForumChatImpl(block: (ForumChatImpl) -> T): T? = forumChatImplOrNull()
?.let(block)
public inline fun Chat.channelChatImplOrNull(): ChannelChatImpl? = this as?
dev.inmo.tgbotapi.types.chat.ChannelChatImpl
public inline fun Chat.channelChatImplOrThrow(): ChannelChatImpl = this as
dev.inmo.tgbotapi.types.chat.ChannelChatImpl
public inline fun <T> Chat.ifChannelChatImpl(block: (ChannelChatImpl) -> T): T? =
channelChatImplOrNull() ?.let(block)
public inline fun Chat.userOrNull(): User? = this as? dev.inmo.tgbotapi.types.chat.User public inline fun Chat.userOrNull(): User? = this as? dev.inmo.tgbotapi.types.chat.User
public inline fun Chat.userOrThrow(): User = this as dev.inmo.tgbotapi.types.chat.User public inline fun Chat.userOrThrow(): User = this as dev.inmo.tgbotapi.types.chat.User
@ -3240,18 +2892,6 @@ public inline fun <T>
ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? = ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? =
sentByChannelOrNull() ?.let(block) sentByChannelOrNull() ?.let(block)
public inline fun Message.channelContentMessageImplOrNull():
ChannelContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.channelContentMessageImplOrThrow():
ChannelContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifChannelContentMessageImpl(block: (ChannelContentMessageImpl<MessageContent>) -> T): T?
= channelContentMessageImplOrNull() ?.let(block)
public inline fun Message.channelEventMessageOrNull(): ChannelEventMessage<ChannelEvent>? = this as? public inline fun Message.channelEventMessageOrNull(): ChannelEventMessage<ChannelEvent>? = this as?
dev.inmo.tgbotapi.types.message.ChannelEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent> dev.inmo.tgbotapi.types.message.ChannelEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent>
@ -3286,90 +2926,6 @@ public inline fun <T>
Message.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T): Message.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
T? = commonSupergroupEventMessageOrNull() ?.let(block) T? = commonSupergroupEventMessageOrNull() ?.let(block)
public inline fun Message.connectedFromChannelGroupContentMessageImplOrNull():
ConnectedFromChannelGroupContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.connectedFromChannelGroupContentMessageImplOrThrow():
ConnectedFromChannelGroupContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifConnectedFromChannelGroupContentMessageImpl(block: (ConnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T):
T? = connectedFromChannelGroupContentMessageImplOrNull() ?.let(block)
public inline fun Message.unconnectedFromChannelGroupContentMessageImplOrNull():
UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.unconnectedFromChannelGroupContentMessageImplOrThrow():
UnconnectedFromChannelGroupContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifUnconnectedFromChannelGroupContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T):
T? = unconnectedFromChannelGroupContentMessageImplOrNull() ?.let(block)
public inline fun Message.anonymousGroupContentMessageImplOrNull():
AnonymousGroupContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.anonymousGroupContentMessageImplOrThrow():
AnonymousGroupContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T):
T? = anonymousGroupContentMessageImplOrNull() ?.let(block)
public inline fun Message.commonGroupContentMessageImplOrNull():
CommonGroupContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.commonGroupContentMessageImplOrThrow():
CommonGroupContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifCommonGroupContentMessageImpl(block: (CommonGroupContentMessageImpl<MessageContent>) -> T):
T? = commonGroupContentMessageImplOrNull() ?.let(block)
public inline fun Message.fromChannelForumContentMessageImplOrNull():
FromChannelForumContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.fromChannelForumContentMessageImplOrThrow():
FromChannelForumContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifFromChannelForumContentMessageImpl(block: (FromChannelForumContentMessageImpl<MessageContent>) -> T):
T? = fromChannelForumContentMessageImplOrNull() ?.let(block)
public inline fun Message.anonymousForumContentMessageImplOrNull():
AnonymousForumContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.anonymousForumContentMessageImplOrThrow():
AnonymousForumContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifAnonymousForumContentMessageImpl(block: (AnonymousForumContentMessageImpl<MessageContent>) -> T):
T? = anonymousForumContentMessageImplOrNull() ?.let(block)
public inline fun Message.commonForumContentMessageImplOrNull():
CommonForumContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.commonForumContentMessageImplOrThrow():
CommonForumContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifCommonForumContentMessageImpl(block: (CommonForumContentMessageImpl<MessageContent>) -> T):
T? = commonForumContentMessageImplOrNull() ?.let(block)
public inline fun Message.passportMessageOrNull(): PassportMessage? = this as? public inline fun Message.passportMessageOrNull(): PassportMessage? = this as?
dev.inmo.tgbotapi.types.message.PassportMessage dev.inmo.tgbotapi.types.message.PassportMessage
@ -3379,18 +2935,6 @@ public inline fun Message.passportMessageOrThrow(): PassportMessage = this as
public inline fun <T> Message.ifPassportMessage(block: (PassportMessage) -> T): T? = public inline fun <T> Message.ifPassportMessage(block: (PassportMessage) -> T): T? =
passportMessageOrNull() ?.let(block) passportMessageOrNull() ?.let(block)
public inline fun Message.privateContentMessageImplOrNull():
PrivateContentMessageImpl<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.privateContentMessageImplOrThrow():
PrivateContentMessageImpl<MessageContent> = this as
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T): T?
= privateContentMessageImplOrNull() ?.let(block)
public inline fun Message.privateEventMessageOrNull(): PrivateEventMessage<PrivateEvent>? = this as? public inline fun Message.privateEventMessageOrNull(): PrivateEventMessage<PrivateEvent>? = this as?
dev.inmo.tgbotapi.types.message.PrivateEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent> dev.inmo.tgbotapi.types.message.PrivateEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent>

View File

@ -8,6 +8,7 @@ import io.ktor.http.encodeURLQueryComponent
fun makeUsernameLink(username: String, threadId: MessageThreadId? = null) = "$internalLinkBeginning/$username${threadId ?.let { "/$it" } ?: ""}" fun makeUsernameLink(username: String, threadId: MessageThreadId? = null) = "$internalLinkBeginning/$username${threadId ?.let { "/$it" } ?: ""}"
fun makeInternalTgUsernameLink(username: String) = "${internalTgAppLinksBeginning}resolve?domain=$username"
fun makeUserLink(userId: UserId) = userId.userLink fun makeUserLink(userId: UserId) = userId.userLink
fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = identifier.toString().replace( fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = identifier.toString().replace(
linkIdRedundantPartRegex, linkIdRedundantPartRegex,
@ -16,6 +17,7 @@ fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = id
"$internalLinkBeginning/c/$bareId${threadId ?.let { "/$it" } ?: ""}" "$internalLinkBeginning/c/$bareId${threadId ?.let { "/$it" } ?: ""}"
} }
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start=" fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
fun makeInternalTgUsernameDeepLinkPrefix(username: String) = "${makeInternalTgUsernameLink(username)}&start="
fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach" fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach"
fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}" fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}"
inline val Username.usernameLink inline val Username.usernameLink
@ -30,6 +32,9 @@ inline val Username.startattachPrefix
get() = makeUsernameStartattachPrefix(usernameWithoutAt) get() = makeUsernameStartattachPrefix(usernameWithoutAt)
inline fun makeLink(username: Username, threadId: MessageThreadId? = null) = username.link(threadId) inline fun makeLink(username: Username, threadId: MessageThreadId? = null) = username.link(threadId)
inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent() inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent()
inline fun makeInternalTgDeepLink(username: String, startParameter: String) = "${makeInternalTgUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent()
inline fun makeInternalTgDeepLink(username: Username, startParameter: String) =
makeInternalTgDeepLink(username.usernameWithoutAt, startParameter)
inline fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data) inline fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data)
inline fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.usernameWithoutAt, startParameter) inline fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.usernameWithoutAt, startParameter)
inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter) inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter)