diff --git a/gradle/templates/mppJsProject.gradle b/gradle/templates/mppJsProject.gradle index 13ad27e45f..459ed1297c 100644 --- a/gradle/templates/mppJsProject.gradle +++ b/gradle/templates/mppJsProject.gradle @@ -4,6 +4,9 @@ project.group = "$group" apply from: "$mpp_publish" kotlin { + compilerOptions { + freeCompilerArgs.add("-Xcontext-parameters") + } js (IR) { browser() nodejs() diff --git a/gradle/templates/mppProjectWithSerialization.gradle b/gradle/templates/mppProjectWithSerialization.gradle index 0f22c297ec..5f564e2aeb 100644 --- a/gradle/templates/mppProjectWithSerialization.gradle +++ b/gradle/templates/mppProjectWithSerialization.gradle @@ -2,6 +2,9 @@ project.version = "$library_version" project.group = "$library_group" kotlin { + compilerOptions { + freeCompilerArgs.add("-Xcontext-parameters") + } jvm { compilations.main { kotlinOptions { diff --git a/tgbotapi.api/api/tgbotapi.api.api b/tgbotapi.api/api/tgbotapi.api.api index ca7c53b678..1e5aeaf681 100644 --- a/tgbotapi.api/api/tgbotapi.api.api +++ b/tgbotapi.api/api/tgbotapi.api.api @@ -3,8 +3,6 @@ public final class dev/inmo/tgbotapi/extensions/api/BotBuilder { public final fun component1 ()Ljava/net/Proxy; public final fun component2 ()Lio/ktor/client/engine/HttpClientEngineFactory; public final fun component3 ()Lkotlin/jvm/functions/Function1; - public final fun copy (Ljava/net/Proxy;Lio/ktor/client/engine/HttpClientEngineFactory;Lkotlin/jvm/functions/Function1;)Ldev/inmo/tgbotapi/extensions/api/BotBuilder; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/api/BotBuilder;Ljava/net/Proxy;Lio/ktor/client/engine/HttpClientEngineFactory;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/api/BotBuilder; public fun equals (Ljava/lang/Object;)Z public final fun getKtorClientConfig ()Lkotlin/jvm/functions/Function1; public final fun getKtorClientEngineFactory ()Lio/ktor/client/engine/HttpClientEngineFactory; @@ -40,7 +38,7 @@ public final class dev/inmo/tgbotapi/extensions/api/BotExtensionsKt { } public final class dev/inmo/tgbotapi/extensions/api/CloseKt { - public static final fun close (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun executeClose (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/DeleteMessageKt { @@ -2480,8 +2478,16 @@ public final class dev/inmo/tgbotapi/extensions/api/thumbs/SetStickerSetThumbnai } public final class dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandlingKt { - public static final fun updateHandlerWithMediaGroupsAdaptation (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;J)Lkotlin/jvm/functions/Function2; - public static synthetic fun updateHandlerWithMediaGroupsAdaptation$default (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;JILjava/lang/Object;)Lkotlin/jvm/functions/Function2; + public static final fun updateHandlerWithMediaGroupsAdaptation (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;JLdev/inmo/kslog/common/KSLog;)Lkotlin/jvm/functions/Function2; + public static synthetic fun updateHandlerWithMediaGroupsAdaptation$default (Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;JLdev/inmo/kslog/common/KSLog;ILjava/lang/Object;)Lkotlin/jvm/functions/Function2; +} + +public final class dev/inmo/tgbotapi/extensions/api/verifications/RemoveChatVerificationKt { + public static final fun removeChatVerification (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/types/ChatIdentifier;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; +} + +public final class dev/inmo/tgbotapi/extensions/api/verifications/RemoveUserVerificationKt { + public static final fun removeUserVerification-dEpx-Zg (Ldev/inmo/tgbotapi/bot/RequestsExecutor;JLkotlin/coroutines/Continuation;)Ljava/lang/Object; } public final class dev/inmo/tgbotapi/extensions/api/verifications/VerifyChatKt { diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt index 11a7fc8647..e3ed1c1e72 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/BotBuilder.kt @@ -12,6 +12,7 @@ import io.ktor.client.engine.* * @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO] * @param ktorClientConfig Config block for preconfiguring of bot [HttpClient] */ +@ConsistentCopyVisibility public data class BotBuilder internal constructor( var proxy: ProxyConfig? = null, var ktorClientEngineFactory: HttpClientEngineFactory? = null, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt index 53f29d2f4a..b98b9ec4aa 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/Close.kt @@ -3,5 +3,4 @@ package dev.inmo.tgbotapi.extensions.api import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.local.Close -@Suppress("unused") -public suspend inline fun TelegramBot.close(): Boolean = execute(Close) +public suspend inline fun TelegramBot.executeClose(): Boolean = execute(Close) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/InternalUtils/UpdatesUtils.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/InternalUtils/UpdatesUtils.kt index dfc627dd14..5a7e81e8f5 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/InternalUtils/UpdatesUtils.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/InternalUtils/UpdatesUtils.kt @@ -17,6 +17,7 @@ internal fun List.convertWithMediaGroupUpdates(): List { for (update in this) { val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let { if (it.content is MediaGroupPartContent) { + @Suppress("UNCHECKED_CAST") it as PossiblySentViaBotCommonMessage } else { null @@ -48,10 +49,4 @@ internal fun List.convertWithMediaGroupUpdates(): List { return resultUpdates } -/** - * @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is - * [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate] - * - * @throws IllegalStateException - */ -internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this +internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): BaseEditMessageUpdate = this diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index 86f2fc1445..d8b40ec162 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.extensions.api import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.tgbotapi.abstracts.Headed import dev.inmo.tgbotapi.abstracts.HorizontallyAccured import dev.inmo.tgbotapi.abstracts.Locationed @@ -19,6 +18,7 @@ import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent +import dev.inmo.tgbotapi.utils.launchWithBotLogger import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.delay @@ -63,7 +63,7 @@ public suspend fun TelegramBot.handleLiveLocation( null } else { val scope = currentCoroutineContext().LinkedSupervisorScope() - scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { + scope.launchWithBotLogger(start = CoroutineStart.LAZY) { while (scope.isActive) { delay(liveTimeMillis) // Remove previous location message info to resend live location message diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/media/EditChatMessageMedia.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/media/EditChatMessageMedia.kt index 41148b9305..5d78f56c3d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/media/EditChatMessageMedia.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/media/EditChatMessageMedia.kt @@ -1,3 +1,5 @@ +@file:Suppress("KDocUnresolvedReference") + package dev.inmo.tgbotapi.extensions.api.edit.media import dev.inmo.tgbotapi.bot.TelegramBot @@ -45,7 +47,7 @@ public suspend fun TelegramBot.editMessageMedia( * as a builder for that */ public suspend fun TelegramBot.editMessageMedia( - message: ContentMessage, + message: ContentMessage, media: TelegramFreeMedia, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ResendMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ResendMessage.kt index 3170b6e325..62d52cfbaf 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ResendMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ResendMessage.kt @@ -10,6 +10,7 @@ import dev.inmo.tgbotapi.types.message.content.MessageContent /** * This method will send [content] to the [chatId] as is */ +@Suppress("UNCHECKED_CAST") public suspend inline fun TelegramBot.resend( chatId: ChatIdentifier, content: T, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendActionDSL.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendActionDSL.kt index 793a221fc0..e2260ffde0 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendActionDSL.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendActionDSL.kt @@ -1,9 +1,7 @@ package dev.inmo.tgbotapi.extensions.api.send import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope -import dev.inmo.micro_utils.coroutines.runCatchingSafely -import dev.inmo.micro_utils.coroutines.safelyWithResult -import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions +import dev.inmo.micro_utils.coroutines.runCatchingLogging import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.send.SendAction import dev.inmo.tgbotapi.types.* @@ -21,6 +19,7 @@ public suspend fun TelegramBot.withAction( actionRequest: SendAction, block: TelegramBotActionCallback ): T { + @Suppress("WRONG_INVOCATION_KIND") contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } @@ -33,7 +32,7 @@ public suspend fun TelegramBot.withAction( delay(refreshTime) } } - val result = runCatchingSafely { block() } + val result = runCatchingLogging(logger = Log) { block() } actionScope.coroutineContext.job.cancel() return result.getOrThrow() } diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt index ecb1e5a9b1..48e8368985 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/utils/UpdatesHandling.kt @@ -1,11 +1,13 @@ package dev.inmo.tgbotapi.extensions.api.utils -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions +import dev.inmo.kslog.common.KSLog +import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions import dev.inmo.tgbotapi.extensions.api.InternalUtils.convertWithMediaGroupUpdates import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.updateshandlers.UpdateReceiver +import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog import dev.inmo.tgbotapi.utils.extensions.accumulateByKey import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel @@ -19,7 +21,8 @@ import kotlinx.coroutines.launch */ public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( output: UpdateReceiver, - mediaGroupsDebounceMillis: Long = 1000L + mediaGroupsDebounceMillis: Long = 1000L, + logger: KSLog = DefaultKTgBotAPIKSLog ): UpdateReceiver { val updatesChannel = Channel(Channel.UNLIMITED) val mediaGroupChannel = Channel>(Channel.UNLIMITED) @@ -29,7 +32,7 @@ public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( ) launch { - launchSafelyWithoutExceptions { + launchLoggingDropExceptions(logger = logger) { for (update in updatesChannel) { val data = update.data when { @@ -40,7 +43,7 @@ public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation( } } } - launchSafelyWithoutExceptions { + launchLoggingDropExceptions(logger = logger) { for ((_, mediaGroup) in mediaGroupAccumulatedChannel) { mediaGroup.convertWithMediaGroupUpdates().forEach { output(it) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveChatVerification.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveChatVerification.kt new file mode 100644 index 0000000000..d8b814ef09 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveChatVerification.kt @@ -0,0 +1,11 @@ +package dev.inmo.tgbotapi.extensions.api.verifications + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.verifications.RemoveChatVerification +import dev.inmo.tgbotapi.types.ChatIdentifier + +public suspend fun TelegramBot.removeChatVerification( + chatId: ChatIdentifier +): Boolean = execute( + RemoveChatVerification(chatId) +) \ No newline at end of file diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveUserVerification.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveUserVerification.kt new file mode 100644 index 0000000000..b361d4d06f --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/verifications/RemoveUserVerification.kt @@ -0,0 +1,11 @@ +package dev.inmo.tgbotapi.extensions.api.verifications + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.verifications.RemoveUserVerification +import dev.inmo.tgbotapi.types.UserId + +public suspend fun TelegramBot.removeUserVerification( + userId: UserId +): Boolean = execute( + RemoveUserVerification(userId) +) \ No newline at end of file diff --git a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt index 1d94e4befe..24718eb688 100644 --- a/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt +++ b/tgbotapi.behaviour_builder.fsm/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.extensions.behaviour_builder import dev.inmo.micro_utils.coroutines.* @@ -8,6 +10,8 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM.Companion.DATA_FSM_KEY import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder +import dev.inmo.tgbotapi.utils.launchWithBotLogger +import dev.inmo.tgbotapi.utils.subscribeWithBotLogger import kotlinx.coroutines.* import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* @@ -72,6 +76,7 @@ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine companion object { + @Suppress("RemoveExplicitTypeArguments") operator fun invoke( behaviourContext: BehaviourContext, handlers: List>, @@ -88,7 +93,7 @@ interface BehaviourContextWithFSM : BehaviourContext, StatesMachine BehaviourContextWithFSM.onStateOrSubstat /** * Add STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Strict means that - * for input [State] will be used [State]::class == [kClass] and any [State] with exactly the same type will pass + * for input [State] will be used [State]::class == I::class and any [State] with exactly the same type will pass * requirements * * @see BehaviourWithFSMStateHandlerHolder @@ -157,7 +162,7 @@ class DefaultBehaviourContextWithFSM( actualHandlersList = additionalHandlers + handlers } - override fun start(scope: CoroutineScope): Job = scope.launchSafelyWithoutExceptions { + override fun start(scope: CoroutineScope): Job = scope.launchWithBotLogger { val statePerformer: suspend (T) -> Unit = { state: T -> val newState = getSubContext(state.context).launchStateHandling(state, actualHandlersList) if (newState != null) { @@ -169,7 +174,7 @@ class DefaultBehaviourContextWithFSM( fun Job.enableRemoveOnCompletion(state: T) { invokeOnCompletion { - launchSafelyWithoutExceptions { + launchWithBotLogger { statesJobsMutex.withLock { if (this@enableRemoveOnCompletion === statesJobs[state]) { statesJobs.remove(state) @@ -179,23 +184,23 @@ class DefaultBehaviourContextWithFSM( } } - statesManager.onStartChain.subscribeSafelyWithoutExceptions(this) { + statesManager.onStartChain.subscribeWithBotLogger(this) { statesJobsMutex.withLock { - runCatchingSafely { statesJobs.remove(it) ?.cancel() } + runCatching { statesJobs.remove(it) ?.cancel() } statesJobs[it] = launch { statePerformer(it) }.apply { enableRemoveOnCompletion(it) } } } - statesManager.onEndChain.subscribeSafelyWithoutExceptions(this) { + statesManager.onEndChain.subscribeWithBotLogger(this) { statesJobsMutex.withLock { - runCatchingSafely { statesJobs.remove(it) ?.cancel() } + runCatching { statesJobs.remove(it) ?.cancel() } } updatesFlows.remove(it.context) ?.cancel() } - statesManager.onChainStateUpdated.subscribeSafelyWithoutExceptions(this) { (old, new) -> + statesManager.onChainStateUpdated.subscribeWithBotLogger(this) { (old, new) -> statesJobsMutex.withLock { - runCatchingSafely { statesJobs.remove(old) ?.cancel() } - runCatchingSafely { statesJobs.remove(new) ?.cancel() } + runCatching { statesJobs.remove(old) ?.cancel() } + runCatching { statesJobs.remove(new) ?.cancel() } statesJobs[new] = launch { statePerformer(new) }.apply { enableRemoveOnCompletion(new) } } if (old.context != new.context) { @@ -205,7 +210,7 @@ class DefaultBehaviourContextWithFSM( statesManager.getActiveStates().forEach { statesJobsMutex.withLock { - runCatchingSafely { statesJobs.remove(it) ?.cancel() } + runCatching { statesJobs.remove(it) ?.cancel() } statesJobs[it] = launch { statePerformer(it) }.apply { enableRemoveOnCompletion(it) } } @@ -213,7 +218,7 @@ class DefaultBehaviourContextWithFSM( } /** * Add NON STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Non strict means that - * for input [State] will be used [KClass.isInstance] and any inheritor of [kClass] will pass this requirement + * for input [State] will be used [KClass.isInstance] and any inheritor of I::class will pass this requirement * * @see BehaviourWithFSMStateHandlerHolder * @see BehaviourContextWithFSM.add @@ -223,7 +228,7 @@ class DefaultBehaviourContextWithFSM( /** * Add STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Strict means that - * for input [State] will be used [State]::class == [kClass] and any [State] with exactly the same type will pass + * for input [State] will be used [State]::class == I::class and any [State] with exactly the same type will pass * requirements * * @see BehaviourWithFSMStateHandlerHolder @@ -295,6 +300,7 @@ class DefaultBehaviourContextWithFSM( * Extracting from [BehaviourContext.data] exists [StatesMachine] by key [DATA_FSM_KEY], which usually some [BehaviourContextWithFSM]. * In case if value absent in [BehaviourContext.data] will return null */ +@Suppress("UNCHECKED_CAST") fun BehaviourContext.fsmOrNull(): StatesMachine? = data[DATA_FSM_KEY] as? StatesMachine /** @@ -303,4 +309,5 @@ fun BehaviourContext.fsmOrNull(): StatesMachine? = data[DATA_FSM_ * * @throws NullPointerException */ +@Suppress("RemoveExplicitTypeArguments") fun BehaviourContext.fsmOrThrow(): StatesMachine = fsmOrNull()!! diff --git a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api index 79c1c8e17a..3fb1d8aa1c 100644 --- a/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api +++ b/tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api @@ -146,7 +146,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/VariantsKt { public static final fun oneOf (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;[Lkotlinx/coroutines/Deferred;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun oneOfActions (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ljava/lang/Iterable;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun oneOfActions (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;[Ldev/inmo/micro_utils/coroutines/DeferredAction;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; - public static final fun parallel (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; + public static final fun parallel (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Deferred; public static final fun withAction (Lkotlinx/coroutines/Deferred;Lkotlin/jvm/functions/Function2;)Ldev/inmo/micro_utils/coroutines/DeferredAction; } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt index 839753c6ff..03fc71c64d 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt @@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.T import dev.inmo.tgbotapi.types.UpdateId import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.updateshandlers.* +import dev.inmo.tgbotapi.utils.launchWithBotLogger import kotlinx.coroutines.* import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* @@ -150,6 +151,7 @@ inline fun BehaviourContext( * * @param updatesFilter This param will not be used anymore */ +@Suppress("UNCHECKED_CAST") fun BC.createSubContext( scope: CoroutineScope = LinkedSupervisorScope(), triggersHolder: TriggersHolder = this.triggersHolder, @@ -217,7 +219,7 @@ fun BC.launchInNewSubContext( updatesUpstreamFlow = updatesUpstreamFlow, subcontextInitialAction = subcontextInitialAction ).apply { - this@apply.launchLoggingDropExceptions(logger = Log) { + this@apply.launchWithBotLogger { behaviourContextReceiver() } }.coroutineContext.job diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/Variants.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/Variants.kt index 457ec155f5..468594762c 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/Variants.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/Variants.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.extensions.behaviour_builder import dev.inmo.micro_utils.coroutines.DeferredAction @@ -5,15 +7,15 @@ import dev.inmo.micro_utils.coroutines.invokeFirstOf import kotlinx.coroutines.Deferred import kotlinx.coroutines.async -suspend fun BehaviourContext.parallel( +fun BehaviourContext.parallel( action: BehaviourContextReceiver ) = async { action() } -inline infix fun Deferred.withAction(noinline callback: suspend (T) -> O) = DeferredAction(this, callback) +infix fun Deferred.withAction(callback: suspend (T) -> O) = DeferredAction(this, callback) -inline fun Deferred.asAction() = DeferredAction(this) { it } +fun Deferred.asAction() = DeferredAction(this) { it } suspend fun BehaviourContext.oneOfActions( deferredActions: Iterable> diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt index ae9371896e..7f0d839af1 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/Base.kt @@ -44,7 +44,7 @@ fun FlowsUpdatesFilter.expectFlow( if (result.isFailure || result.getOrThrow().isEmpty()) { if (cancelTrigger(it)) { cancelRequestFactory(it) ?.also { - safelyWithResult { bot.execute(it) } + runCatching { bot.execute(it) } throw cancelledByFilterException } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitChatMessageReactionsCountUpdatedUpdates.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitChatMessageReactionsCountUpdatedUpdates.kt index aa881a7c84..1e4f778ca7 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitChatMessageReactionsCountUpdatedUpdates.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitChatMessageReactionsCountUpdatedUpdates.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext @@ -10,9 +12,9 @@ import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage import kotlinx.coroutines.flow.Flow -inline fun BehaviourContext.waitChatMessageReactionsCountUpdated( +fun BehaviourContext.waitChatMessageReactionsCountUpdated( initRequest: Request<*>? = null, - noinline errorFactory: NullableRequestBuilder<*> = { null } + errorFactory: NullableRequestBuilder<*> = { null } ): Flow = expectFlow( initRequest, errorFactory diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCommandsMessages.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCommandsMessages.kt index 7fea8ddc3b..c9cd4bc4ea 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCommandsMessages.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitCommandsMessages.kt @@ -1,3 +1,5 @@ +@file:Suppress("OPT_IN_USAGE") + package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroup.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroup.kt index 7279df71ab..cb3380822b 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroup.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroup.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext @@ -17,7 +19,8 @@ inline fun BehaviourContext.buildMediaGroupW noinline errorFactory: NullableRequestBuilder<*> = { null } ): Flow> = flowsUpdatesFilter.expectFlow(bot, initRequest, errorFactory) { update -> update.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { message -> - if (message.content.group.all { it is T }) { + if (message.content.group.all { it.content is T }) { + @Suppress("UNCHECKED_CAST") listOf(message.content as MediaGroupContent) } else { null diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroupMessages.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroupMessages.kt index 205b33b44f..39e20872c2 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroupMessages.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitMediaGroupMessages.kt @@ -17,7 +17,8 @@ inline fun BehaviourContext.buildMediaGroupM noinline errorFactory: NullableRequestBuilder<*> = { null } ): Flow> = flowsUpdatesFilter.expectFlow(bot, initRequest, errorFactory) { update -> update.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { message -> - if (message.content.group.all { it is T }) { + if (message.content.group.all { it.content is T }) { + @Suppress("UNCHECKED_CAST") listOf(message as MediaGroupMessage) } else { null diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt index 00940c0ef0..190af4c1ec 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CallbackQueryTriggers.kt @@ -2,8 +2,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CallbackQueryFilterByUser import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter @@ -13,6 +11,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times import dev.inmo.tgbotapi.extensions.utils.callbackQueryUpdateOrNull import dev.inmo.tgbotapi.types.queries.callback.* import dev.inmo.tgbotapi.types.update.abstracts.Update +import dev.inmo.tgbotapi.utils.launchWithBotLogger import kotlinx.coroutines.Job internal inline fun BC.onCallbackQuery( @@ -63,7 +62,7 @@ internal inline fun BC.on this@launchInNewSubContext.triggersHolder.handleableCallbackQueriesDataHolder.registerHandleable(newInitialFilterInvoke) it.invokeOnCompletion { runCatching { - launchSafelyWithoutExceptions { + launchWithBotLogger { this@launchInNewSubContext.triggersHolder.handleableCallbackQueriesDataHolder.unregisterHandleable(newInitialFilterInvoke) } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt index 8479e63e5f..dd3fc253ff 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/CommandHandling.kt @@ -2,10 +2,6 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling -import dev.inmo.kslog.common.KSLog -import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilterExcludeMediaGroups import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat @@ -20,6 +16,7 @@ import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.message.content.TextMessage import dev.inmo.tgbotapi.types.update.abstracts.Update +import dev.inmo.tgbotapi.utils.launchWithBotLogger import kotlinx.coroutines.Job import kotlinx.coroutines.job @@ -77,7 +74,7 @@ fun BC.command( triggersHolder.handleableCommandsHolder.registerHandleable(commandRegex) it.invokeOnCompletion { runCatching { - launchSafelyWithoutExceptions { + launchWithBotLogger { triggersHolder.handleableCommandsHolder.unregisterHandleable(commandRegex) } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt index b9e80bc2e4..78a9e26971 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/DeepLinkHandling.kt @@ -15,6 +15,7 @@ import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.message.content.TextMessage import dev.inmo.tgbotapi.types.message.textsources.RegularTextSource import dev.inmo.tgbotapi.types.update.abstracts.Update +import dev.inmo.tgbotapi.utils.launchWithBotLogger import io.ktor.http.decodeURLQueryComponent import kotlinx.coroutines.Job @@ -43,7 +44,7 @@ fun BC.onDeepLink( }.also { triggersHolder.handleableCommandsHolder.registerHandleable(startRegex) it.invokeOnCompletion { - this@onDeepLink.launchSafelyWithoutExceptions { triggersHolder.handleableCommandsHolder.unregisterHandleable(startRegex) } + this@onDeepLink.launchWithBotLogger { triggersHolder.handleableCommandsHolder.unregisterHandleable(startRegex) } } } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt index d25e9ef0ae..091fc209c9 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MainTrigger.kt @@ -1,17 +1,17 @@ +@file:OptIn(ExperimentalCoroutinesApi::class) + package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.micro_utils.coroutines.SpecialMutableStateFlow -import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.subscribeLoggingDropExceptions -import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptionsAsync import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.expectFlow import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory -import dev.inmo.tgbotapi.extensions.utils.flatMap import dev.inmo.tgbotapi.types.update.abstracts.Update +import dev.inmo.tgbotapi.utils.launchWithBotLogger +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.emptyFlow import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flatMapLatest @@ -75,7 +75,7 @@ internal fun BC.on( block = handler ) } ?: subscribeLoggingDropExceptions(scope) { - scope.launchLoggingDropExceptions { + scope.launchWithBotLogger { handler(it) } } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt index 70e77e18be..c21c557300 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupMessagesTriggers.kt @@ -24,6 +24,7 @@ internal inline fun B ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) { it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { if (it.content.group.all { it.content is T }) { + @Suppress("UNCHECKED_CAST") listOf(it as MediaGroupMessage) } else { null diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt index 57f0bd0977..85c28fe262 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/MediaGroupTriggers.kt @@ -24,6 +24,7 @@ internal inline fun B ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) { it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull>() ?.let { if (it.content.group.all { it.content is T }) { + @Suppress("UNCHECKED_CAST") listOf(it.content as MediaGroupContent) } else { null diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt index 957444505f..59bb40fb94 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/PollAnswersTriggers.kt @@ -10,12 +10,12 @@ import dev.inmo.tgbotapi.extensions.utils.pollAnswerUpdateOrNull import dev.inmo.tgbotapi.types.polls.PollAnswer import dev.inmo.tgbotapi.types.update.abstracts.Update -internal inline fun BC.onPollAnswered( +internal fun BC.onPollAnswered( initialFilter: SimpleFilter? = null, - noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, + subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver? = null, markerFactory: MarkerFactory? = ByIdPollAnswerMarkerFactory, - noinline additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver? = null, - noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver + additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver? = null, + scenarioReceiver: CustomBehaviourContextAndTypeReceiver ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, additionalSubcontextInitialAction, scenarioReceiver) { (it.pollAnswerUpdateOrNull() ?.data) ?.let(::listOfNotNull) } diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/HandleableTriggersHolder.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/HandleableTriggersHolder.kt index 784dd25654..6478b664a2 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/HandleableTriggersHolder.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/HandleableTriggersHolder.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar -import dev.inmo.micro_utils.coroutines.runCatchingSafely import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock @@ -40,7 +39,7 @@ suspend fun HandleableTriggersHolder.doWithRegistration( block: suspend () -> R ): R { registerHandleable(data) - val result = runCatchingSafely { + val result = runCatching { block() } unregisterHandleable(data) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/AnyMarkerFactory.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/AnyMarkerFactory.kt index dcf3059fcd..c9e8e2fa91 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/AnyMarkerFactory.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/AnyMarkerFactory.kt @@ -1,3 +1,5 @@ +@file:Suppress("UNCHECKED_CAST") + package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories private val commonAnyMarker = MarkerFactory { it } diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 7124cd95db..8dfdadffa8 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -1315,8 +1315,6 @@ public final class dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$S public final class dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$Unknown : dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton { public static final field Companion Ldev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$Unknown$Companion; public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$Unknown; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$Unknown;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton$Unknown; public fun equals (Ljava/lang/Object;)Z public fun getText ()Ljava/lang/String; public fun hashCode ()I @@ -4341,8 +4339,6 @@ public final class dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaptio public final fun component6-nXr5wdE ()Ljava/lang/String; public final fun component7 ()Z public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-cEjrTps (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;)Ldev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption; - public static synthetic fun copy-cEjrTps$default (Ldev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption; public fun equals (Ljava/lang/Object;)Z public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; @@ -4391,8 +4387,6 @@ public final class dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCapt public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component5 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-qSk9tD0 (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;)Ldev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption; - public static synthetic fun copy-qSk9tD0$default (Ldev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getInlineMessageId-u1p_GH0 ()Ljava/lang/String; @@ -4852,8 +4846,6 @@ public final class dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText : de public final fun component6-nXr5wdE ()Ljava/lang/String; public final fun component7 ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-cEjrTps (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;)Ldev/inmo/tgbotapi/requests/edit/text/EditChatMessageText; - public static synthetic fun copy-cEjrTps$default (Ldev/inmo/tgbotapi/requests/edit/text/EditChatMessageText;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/edit/text/EditChatMessageText; public fun equals (Ljava/lang/Object;)Z public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; @@ -4905,8 +4897,6 @@ public final class dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText : public final fun component5 ()Z public final fun component6 ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; public final fun component7 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-bH2Jftc (Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/LinkPreviewOptions;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;)Ldev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText; - public static synthetic fun copy-bH2Jftc$default (Ldev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/LinkPreviewOptions;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText; public fun equals (Ljava/lang/Object;)Z public fun getDisableWebPagePreview ()Ljava/lang/Boolean; public fun getEntities ()Ljava/util/List; @@ -5373,8 +5363,6 @@ public final class dev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription : de public final fun component3 ()I public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; - public final fun copy-hWD7qso (JIILjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;)Ldev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription; - public static synthetic fun copy-hWD7qso$default (Ldev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription;JIILjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public final fun getMonthCount ()I @@ -5418,8 +5406,6 @@ public final class dev/inmo/tgbotapi/requests/gifts/SendGift : dev/inmo/tgbotapi public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component7 ()Z - public final fun copy-xmxulwY (Ldev/inmo/tgbotapi/types/ChatId;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Z)Ldev/inmo/tgbotapi/requests/gifts/SendGift; - public static synthetic fun copy-xmxulwY$default (Ldev/inmo/tgbotapi/requests/gifts/SendGift;Ldev/inmo/tgbotapi/types/ChatId;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/gifts/SendGift; public fun equals (Ljava/lang/Object;)Z public final fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public fun getEntities ()Ljava/util/List; @@ -5532,8 +5518,6 @@ public final class dev/inmo/tgbotapi/requests/send/CopyMessage : dev/inmo/tgbota public final fun component7 ()Z public final fun component8-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public final fun component9 ()Ljava/lang/Integer; - public final fun copy-iAqBLco (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Integer;ZZZLdev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/CopyMessage; - public static synthetic fun copy-iAqBLco$default (Ldev/inmo/tgbotapi/requests/send/CopyMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/Integer;ZZZLdev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/CopyMessage; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -5999,8 +5983,6 @@ public final class dev/inmo/tgbotapi/requests/send/SendTextMessage : dev/inmo/tg public final fun component7 ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; public final fun component8 ()Z public final fun component9 ()Z - public final fun copy-NChqpRY (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendTextMessage; - public static synthetic fun copy-NChqpRY$default (Ldev/inmo/tgbotapi/requests/send/SendTextMessage;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendTextMessage; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6325,8 +6307,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendAnimationData : dev public final fun component7 ()Z public final fun component8 ()Z public final fun component9 ()Ljava/lang/Long; - public final fun copy-k4bYsrE (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendAnimationData; - public static synthetic fun copy-k4bYsrE$default (Ldev/inmo/tgbotapi/requests/send/media/SendAnimationData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendAnimationData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6387,8 +6367,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendAnimationFiles : ja public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendAnimationFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendAnimationFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendAnimationFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -6449,8 +6427,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendAudioData : dev/inm public final fun component7 ()Ljava/lang/Long; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/lang/String; - public final fun copy-fnMCT1Y (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendAudioData; - public static synthetic fun copy-fnMCT1Y$default (Ldev/inmo/tgbotapi/requests/send/media/SendAudioData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendAudioData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6509,8 +6485,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendAudioFiles : java/u public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendAudioFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendAudioFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendAudioFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -6569,8 +6543,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendDocumentData : dev/ public final fun component7-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public final fun component8-nXr5wdE ()Ljava/lang/String; public final fun component9 ()Z - public final fun copy-CoeeeEM (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/requests/send/media/SendDocumentData; - public static synthetic fun copy-CoeeeEM$default (Ldev/inmo/tgbotapi/requests/send/media/SendDocumentData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendDocumentData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6627,8 +6599,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendDocumentFiles : jav public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendDocumentFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendDocumentFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendDocumentFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -6682,8 +6652,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendMediaGroupData : de public final fun component7 ()Z public final fun component8-Ts0V7ak ()Ljava/lang/String; public final fun component9 ()Ldev/inmo/tgbotapi/types/ReplyParameters; - public final fun copy-aWUkcs0 (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;)Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupData; - public static synthetic fun copy-aWUkcs0$default (Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ljava/util/List;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6731,8 +6699,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendMediaGroupFiles : j public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ljava/util/List;)Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupFiles;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendMediaGroupFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -6795,8 +6761,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendPaidMediaData : dev public final fun component7-Y25QJn4 ()Ljava/lang/String; public final fun component8 ()Z public final fun component9-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; - public final fun copy-vxIIXgw (Ldev/inmo/tgbotapi/types/ChatIdentifier;ILjava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLdev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaData; - public static synthetic fun copy-vxIIXgw$default (Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaData;Ldev/inmo/tgbotapi/types/ChatIdentifier;ILjava/util/List;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/String;ZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLdev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6852,8 +6816,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendPaidMediaFiles : ja public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendPaidMediaFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -6911,8 +6873,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendPhotoData : dev/inm public final fun component7 ()Z public final fun component8-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public final fun component9-nXr5wdE ()Ljava/lang/String; - public final fun copy-274AP-Q (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendPhotoData; - public static synthetic fun copy-274AP-Q$default (Ldev/inmo/tgbotapi/requests/send/media/SendPhotoData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendPhotoData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -6967,8 +6927,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendPhotoFiles : java/u public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendPhotoFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendPhotoFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendPhotoFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -7023,8 +6981,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendStickerByFileId : d public final fun component7 ()Z public final fun component8 ()Z public final fun component9-Ts0V7ak ()Ljava/lang/String; - public final fun copy-S2mil8w (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendStickerByFileId; - public static synthetic fun copy-S2mil8w$default (Ldev/inmo/tgbotapi/requests/send/media/SendStickerByFileId;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendStickerByFileId; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -7090,8 +7046,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVideoData : dev/inm public final fun component6 ()Ljava/lang/String; public final fun component7 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component9 ()Z - public final fun copy-2N3v4LM (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoData; - public static synthetic fun copy-2N3v4LM$default (Ldev/inmo/tgbotapi/requests/send/media/SendVideoData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Long;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -7155,8 +7109,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVideoFiles : java/u public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendVideoFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -7214,8 +7166,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVideoNoteData : dev public final fun component7-nXr5wdE ()Ljava/lang/String; public final fun component8 ()Z public final fun component9 ()Z - public final fun copy-e6jUd8c (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteData; - public static synthetic fun copy-e6jUd8c$default (Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -7270,8 +7220,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVideoNoteFiles : ja public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVideoNoteFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -7327,8 +7275,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVoiceData : dev/inm public final fun component7-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public final fun component8-nXr5wdE ()Ljava/lang/String; public final fun component9 ()Z - public final fun copy-5jCUU4o (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/media/SendVoiceData; - public static synthetic fun copy-5jCUU4o$default (Ldev/inmo/tgbotapi/requests/send/media/SendVoiceData;Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVoiceData; public fun equals (Ljava/lang/Object;)Z public fun getAllowPaidBroadcast ()Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; @@ -7384,8 +7330,6 @@ public final class dev/inmo/tgbotapi/requests/send/media/SendVoiceFiles : java/u public fun containsKey (Ljava/lang/String;)Z public fun containsValue (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Z public final fun containsValue (Ljava/lang/Object;)Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;)Ldev/inmo/tgbotapi/requests/send/media/SendVoiceFiles; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/send/media/SendVoiceFiles;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/media/SendVoiceFiles; public final fun entrySet ()Ljava/util/Set; public fun equals (Ljava/lang/Object;)Z public final fun get (Ljava/lang/Object;)Ldev/inmo/tgbotapi/requests/abstracts/MultipartFile; @@ -7812,8 +7756,6 @@ public final class dev/inmo/tgbotapi/requests/stickers/AddStickerToSetData : dev public final fun component1-tHkBKVM ()J public final fun component2-KVV53SM ()Ljava/lang/String; public final fun component3 ()Ldev/inmo/tgbotapi/requests/stickers/InputSticker; - public final fun copy-FKW6xZo (JLjava/lang/String;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;)Ldev/inmo/tgbotapi/requests/stickers/AddStickerToSetData; - public static synthetic fun copy-FKW6xZo$default (Ldev/inmo/tgbotapi/requests/stickers/AddStickerToSetData;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stickers/AddStickerToSetData; public fun equals (Ljava/lang/Object;)Z public fun getName-KVV53SM ()Ljava/lang/String; public fun getNewSticker ()Ldev/inmo/tgbotapi/requests/stickers/InputSticker; @@ -7990,8 +7932,6 @@ public final class dev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet$Surro public final fun component4 ()Ljava/util/List; public final fun component5 ()Ldev/inmo/tgbotapi/types/StickerType; public final fun component6 ()Ljava/lang/Boolean; - public final fun copy-zj6nCqY (JLjava/lang/String;Ljava/lang/String;Ljava/util/List;Ldev/inmo/tgbotapi/types/StickerType;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet$SurrogateCreateNewSticker; - public static synthetic fun copy-zj6nCqY$default (Ldev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet$SurrogateCreateNewSticker;JLjava/lang/String;Ljava/lang/String;Ljava/util/List;Ldev/inmo/tgbotapi/types/StickerType;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stickers/CreateNewStickerSet$SurrogateCreateNewSticker; public fun equals (Ljava/lang/Object;)Z public fun getName-KVV53SM ()Ljava/lang/String; public final fun getNeedsRepainting ()Ljava/lang/Boolean; @@ -8224,8 +8164,6 @@ public final class dev/inmo/tgbotapi/requests/stickers/InputStickerSerializer$Su public final fun component3 ()Ljava/util/List; public final fun component4 ()Ljava/util/List; public final fun component5 ()Ldev/inmo/tgbotapi/types/stickers/MaskPosition; - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Ldev/inmo/tgbotapi/types/StickerType;)Ldev/inmo/tgbotapi/requests/stickers/InputStickerSerializer$SurrogateInputSticker; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/stickers/InputStickerSerializer$SurrogateInputSticker;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ldev/inmo/tgbotapi/types/StickerFormat;Ljava/util/List;Ljava/util/List;Ldev/inmo/tgbotapi/types/stickers/MaskPosition;Ldev/inmo/tgbotapi/types/StickerType;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stickers/InputStickerSerializer$SurrogateInputSticker; public fun equals (Ljava/lang/Object;)Z public final fun getEmojisList ()Ljava/util/List; public final fun getFormat ()Ldev/inmo/tgbotapi/types/StickerFormat; @@ -8257,8 +8195,6 @@ public final class dev/inmo/tgbotapi/requests/stickers/ReplaceStickerInSetData : public final fun component2-KVV53SM ()Ljava/lang/String; public final fun component3 ()Ldev/inmo/tgbotapi/requests/abstracts/FileId; public final fun component4 ()Ldev/inmo/tgbotapi/requests/stickers/InputSticker; - public final fun copy-ekB4Uzg (JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;)Ldev/inmo/tgbotapi/requests/stickers/ReplaceStickerInSetData; - public static synthetic fun copy-ekB4Uzg$default (Ldev/inmo/tgbotapi/requests/stickers/ReplaceStickerInSetData;JLjava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ldev/inmo/tgbotapi/requests/stickers/InputSticker;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stickers/ReplaceStickerInSetData; public fun equals (Ljava/lang/Object;)Z public fun getName-KVV53SM ()Ljava/lang/String; public fun getNewSticker ()Ldev/inmo/tgbotapi/requests/stickers/InputSticker; @@ -8652,8 +8588,6 @@ public final class dev/inmo/tgbotapi/requests/stories/EditStory : dev/inmo/tgbot public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component7 ()Ljava/util/List; - public final fun copy-isQzPXY (Ljava/lang/String;JLdev/inmo/tgbotapi/types/stories/InputStoryContent;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/util/List;)Ldev/inmo/tgbotapi/requests/stories/EditStory; - public static synthetic fun copy-isQzPXY$default (Ldev/inmo/tgbotapi/requests/stories/EditStory;Ljava/lang/String;JLdev/inmo/tgbotapi/types/stories/InputStoryContent;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stories/EditStory; public fun equals (Ljava/lang/Object;)Z public final fun getAreas ()Ljava/util/List; public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String; @@ -8709,8 +8643,6 @@ public final class dev/inmo/tgbotapi/requests/stories/PostStory : dev/inmo/tgbot public final fun component7 ()Ljava/util/List; public final fun component8 ()Z public final fun component9 ()Z - public final fun copy-beo5bKg (Ljava/lang/String;Ldev/inmo/tgbotapi/types/stories/InputStoryContent;ILjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/util/List;ZZ)Ldev/inmo/tgbotapi/requests/stories/PostStory; - public static synthetic fun copy-beo5bKg$default (Ldev/inmo/tgbotapi/requests/stories/PostStory;Ljava/lang/String;Ldev/inmo/tgbotapi/types/stories/InputStoryContent;ILjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/util/List;ZZILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/stories/PostStory; public fun equals (Ljava/lang/Object;)Z public final fun getActivePeriod ()I public final fun getAreas ()Ljava/util/List; @@ -8938,8 +8870,6 @@ public final class dev/inmo/tgbotapi/requests/webhook/SetWebhook : dev/inmo/tgbo public final fun component5 ()Ljava/util/List; public final fun component6 ()Ljava/lang/Boolean; public final fun component7 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/webhook/SetWebhook; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/requests/webhook/SetWebhook;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/webhook/SetWebhook; public fun equals (Ljava/lang/Object;)Z public final fun getAllowedUpdates ()Ljava/util/List; public final fun getCertificateFile ()Ljava/lang/String; @@ -10940,8 +10870,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component4 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component6 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component7 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-bK9-QN0 (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl; - public static synthetic fun copy-bK9-QN0$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getFileId ()Ldev/inmo/tgbotapi/requests/abstracts/FileId; @@ -10990,8 +10918,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component6 ()Ljava/lang/String; public final fun component7 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component9 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-mRbB0zs (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl; - public static synthetic fun copy-mRbB0zs$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Integer; public fun getEntities ()Ljava/util/List; @@ -11089,8 +11015,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component6 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component9 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-L6b5ui0 (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl; - public static synthetic fun copy-L6b5ui0$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getEntities ()Ljava/util/List; @@ -11144,8 +11068,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/lang/String; - public final fun copy-BXzB6xg (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl; - public static synthetic fun copy-BXzB6xg$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getEntities ()Ljava/util/List; @@ -11224,8 +11146,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Z public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component9 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-L6b5ui0 (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl; - public static synthetic fun copy-L6b5ui0$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getFileId ()Ldev/inmo/tgbotapi/requests/abstracts/FileId; @@ -11280,8 +11200,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/lang/String; - public final fun copy-Vi6B_GQ (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl; - public static synthetic fun copy-Vi6B_GQ$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Integer; public fun getEntities ()Ljava/util/List; @@ -11393,8 +11311,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Z public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component9 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-L6b5ui0 (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl; - public static synthetic fun copy-L6b5ui0$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getFileId ()Ldev/inmo/tgbotapi/requests/abstracts/FileId; @@ -11449,8 +11365,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ljava/lang/String; - public final fun copy-Vi6B_GQ (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl; - public static synthetic fun copy-Vi6B_GQ$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Integer; public fun getEntities ()Ljava/util/List; @@ -11506,8 +11420,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component6 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component8 ()Z public final fun component9 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-mRbB0zs (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl; - public static synthetic fun copy-mRbB0zs$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getEntities ()Ljava/util/List; @@ -11562,8 +11474,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Ljava/lang/String; public final fun component8 ()Ljava/lang/String; public final fun component9 ()Ldev/inmo/tgbotapi/types/message/ParseMode; - public final fun copy-BXzB6xg (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl; - public static synthetic fun copy-BXzB6xg$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getEntities ()Ljava/util/List; @@ -11708,8 +11618,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component6 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component8 ()Z public final fun component9 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; - public final fun copy-mRbB0zs (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl; - public static synthetic fun copy-mRbB0zs$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getEntities ()Ljava/util/List; @@ -11766,8 +11674,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Ljava/lang/Integer; public final fun component9 ()Ljava/lang/String; - public final fun copy-qXbAnbE (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl; - public static synthetic fun copy-qXbAnbE$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/utils/MimeType;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl; public fun equals (Ljava/lang/Object;)Z public fun getDescription ()Ljava/lang/String; public fun getDuration ()Ljava/lang/Integer; @@ -11822,8 +11728,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component7 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component8 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-3XIVVSw (Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl; - public static synthetic fun copy-3XIVVSw$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/FileId;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getFileId ()Ldev/inmo/tgbotapi/requests/abstracts/FileId; @@ -11872,8 +11776,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/Inlin public final fun component6 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component8 ()Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup; public final fun component9 ()Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent; - public final fun copy-L6b5ui0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl; - public static synthetic fun copy-L6b5ui0$default (Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardMarkup;Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputMessageContent;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Integer; public fun getEntities ()Ljava/util/List; @@ -12289,8 +12191,6 @@ public final class dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/Inp public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component4 ()Ldev/inmo/tgbotapi/types/LinkPreviewOptions; - public final fun copy (Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/types/LinkPreviewOptions;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent; public fun equals (Ljava/lang/Object;)Z public fun getDisableWebPagePreview ()Ljava/lang/Boolean; public fun getEntities ()Ljava/util/List; @@ -13274,8 +13174,6 @@ public final class dev/inmo/tgbotapi/types/ReplyParameters : dev/inmo/tgbotapi/a public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component7 ()Ljava/lang/Integer; - public final fun copy-JOF9uy8 (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;)Ldev/inmo/tgbotapi/types/ReplyParameters; - public static synthetic fun copy-JOF9uy8$default (Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/ReplyParameters; public fun equals (Ljava/lang/Object;)Z public final fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; public final fun getChatIdentifier ()Ldev/inmo/tgbotapi/types/ChatIdentifier; @@ -13716,8 +13614,6 @@ public final class dev/inmo/tgbotapi/types/TextQuote : dev/inmo/tgbotapi/abstrac public final fun component1 ()Ljava/lang/String; public final fun component2 ()I public final fun component4 ()Z - public final fun copy (Ljava/lang/String;ILjava/util/List;Z)Ldev/inmo/tgbotapi/types/TextQuote; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/TextQuote;Ljava/lang/String;ILjava/util/List;ZILjava/lang/Object;)Ldev/inmo/tgbotapi/types/TextQuote; public fun equals (Ljava/lang/Object;)Z public final fun getPosition ()I public fun getText ()Ljava/lang/String; @@ -15765,8 +15661,6 @@ public final class dev/inmo/tgbotapi/types/buttons/UnknownKeyboardButton : dev/i public static final field Companion Ldev/inmo/tgbotapi/types/buttons/UnknownKeyboardButton$Companion; public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Ldev/inmo/tgbotapi/types/buttons/UnknownKeyboardButton; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/buttons/UnknownKeyboardButton;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/buttons/UnknownKeyboardButton; public fun equals (Ljava/lang/Object;)Z public final fun getRaw ()Ljava/lang/String; public fun getText ()Ljava/lang/String; @@ -16142,8 +16036,6 @@ public final class dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated$Surro public final fun component5 ()Ldev/inmo/tgbotapi/types/TelegramDate; public final fun component6 ()Ljava/util/List; public final fun component7 ()Ljava/util/List; - public final fun copy-JOF9uy8 (Ldev/inmo/tgbotapi/types/chat/PreviewChat;JLdev/inmo/tgbotapi/types/chat/PreviewUser;Ldev/inmo/tgbotapi/types/chat/PreviewChat;Ldev/inmo/tgbotapi/types/TelegramDate;Ljava/util/List;Ljava/util/List;)Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated$Surrogate; - public static synthetic fun copy-JOF9uy8$default (Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated$Surrogate;Ldev/inmo/tgbotapi/types/chat/PreviewChat;JLdev/inmo/tgbotapi/types/chat/PreviewUser;Ldev/inmo/tgbotapi/types/chat/PreviewChat;Ldev/inmo/tgbotapi/types/TelegramDate;Ljava/util/List;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated$Surrogate; public fun equals (Ljava/lang/Object;)Z public final fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewChat; public final fun getDate ()Ldev/inmo/tgbotapi/types/TelegramDate; @@ -16414,8 +16306,11 @@ public abstract class dev/inmo/tgbotapi/types/chat/ChatType { public final class dev/inmo/tgbotapi/types/chat/ChatType$Channel : dev/inmo/tgbotapi/types/chat/ChatType { public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/ChatType$Channel; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Companion { @@ -16424,32 +16319,50 @@ public final class dev/inmo/tgbotapi/types/chat/ChatType$Companion { public final class dev/inmo/tgbotapi/types/chat/ChatType$Group : dev/inmo/tgbotapi/types/chat/ChatType { public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/ChatType$Group; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Private : dev/inmo/tgbotapi/types/chat/ChatType { public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/ChatType$Private; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Sender : dev/inmo/tgbotapi/types/chat/ChatType { public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/ChatType$Sender; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Supergroup : dev/inmo/tgbotapi/types/chat/ChatType { public static final field INSTANCE Ldev/inmo/tgbotapi/types/chat/ChatType$Supergroup; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I public final fun serializer ()Lkotlinx/serialization/KSerializer; + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Unknown : dev/inmo/tgbotapi/types/chat/ChatType { public static final field Companion Ldev/inmo/tgbotapi/types/chat/ChatType$Unknown$Companion; public fun (Ljava/lang/String;)V + public final fun component1 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;)Ldev/inmo/tgbotapi/types/chat/ChatType$Unknown; + public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/chat/ChatType$Unknown;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/chat/ChatType$Unknown; + public fun equals (Ljava/lang/Object;)Z public fun getStringified ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class dev/inmo/tgbotapi/types/chat/ChatType$Unknown$Companion { @@ -18588,8 +18501,6 @@ public abstract interface class dev/inmo/tgbotapi/types/commands/ChatBotCommandS public final class dev/inmo/tgbotapi/types/commands/UnknownBotCommandScope : dev/inmo/tgbotapi/types/commands/BotCommandScope { public static final field Companion Ldev/inmo/tgbotapi/types/commands/UnknownBotCommandScope$Companion; public final fun component1 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;)Ldev/inmo/tgbotapi/types/commands/UnknownBotCommandScope; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/commands/UnknownBotCommandScope;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/commands/UnknownBotCommandScope; public fun equals (Ljava/lang/Object;)Z public fun getType ()Ljava/lang/String; public fun hashCode ()I @@ -21155,8 +21066,6 @@ public final class dev/inmo/tgbotapi/types/media/TelegramMediaAnimation : dev/in public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Ljava/lang/Integer; public final fun component9 ()Ljava/lang/Long; - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;)Ldev/inmo/tgbotapi/types/media/TelegramMediaAnimation; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/media/TelegramMediaAnimation;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/media/TelegramMediaAnimation; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Long; public fun getEntities ()Ljava/util/List; @@ -21206,8 +21115,6 @@ public final class dev/inmo/tgbotapi/types/media/TelegramMediaAudio : dev/inmo/t public final fun component6 ()Ljava/lang/String; public final fun component7 ()Ljava/lang/String; public final fun component8 ()Ldev/inmo/tgbotapi/requests/abstracts/InputFile; - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;)Ldev/inmo/tgbotapi/types/media/TelegramMediaAudio; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/media/TelegramMediaAudio;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/media/TelegramMediaAudio; public fun equals (Ljava/lang/Object;)Z public fun getDuration ()Ljava/lang/Long; public fun getEntities ()Ljava/util/List; @@ -21258,8 +21165,6 @@ public final class dev/inmo/tgbotapi/types/media/TelegramMediaDocument : dev/inm public final fun component3 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component5 ()Ldev/inmo/tgbotapi/requests/abstracts/InputFile; public final fun component6 ()Ljava/lang/Boolean; - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/types/media/TelegramMediaDocument; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/media/TelegramMediaDocument;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/media/TelegramMediaDocument; public fun equals (Ljava/lang/Object;)Z public final fun getDisableContentTypeDetection ()Ljava/lang/Boolean; public fun getEntities ()Ljava/util/List; @@ -21308,8 +21213,6 @@ public final class dev/inmo/tgbotapi/types/media/TelegramMediaPhoto : dev/inmo/t public final fun component3 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component5 ()Z public final fun component6 ()Z - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZ)Ldev/inmo/tgbotapi/types/media/TelegramMediaPhoto; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/media/TelegramMediaPhoto;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZZILjava/lang/Object;)Ldev/inmo/tgbotapi/types/media/TelegramMediaPhoto; public fun equals (Ljava/lang/Object;)Z public fun getEntities ()Ljava/util/List; public fun getFile ()Ldev/inmo/tgbotapi/requests/abstracts/InputFile; @@ -21373,8 +21276,6 @@ public final class dev/inmo/tgbotapi/types/media/TelegramMediaVideo : dev/inmo/t public final fun component7 ()Ljava/lang/Integer; public final fun component8 ()Z public final fun component9 ()Ljava/lang/Integer; - public final fun copy (Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Integer;ZLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;)Ldev/inmo/tgbotapi/types/media/TelegramMediaVideo; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/media/TelegramMediaVideo;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;ZLdev/inmo/tgbotapi/requests/abstracts/InputFile;Ljava/lang/Integer;ZLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Long;Ldev/inmo/tgbotapi/requests/abstracts/InputFile;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/media/TelegramMediaVideo; public fun equals (Ljava/lang/Object;)Z public fun getCover ()Ldev/inmo/tgbotapi/requests/abstracts/InputFile; public fun getDuration ()Ljava/lang/Long; @@ -22757,8 +22658,6 @@ public final class dev/inmo/tgbotapi/types/message/MessageOrigin$Unknown : dev/i public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/TelegramDate; public final fun component3 ()Lkotlinx/serialization/json/JsonElement; - public final fun copy (Ljava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlinx/serialization/json/JsonElement;)Ldev/inmo/tgbotapi/types/message/MessageOrigin$Unknown; - public static synthetic fun copy$default (Ldev/inmo/tgbotapi/types/message/MessageOrigin$Unknown;Ljava/lang/String;Ldev/inmo/tgbotapi/types/TelegramDate;Lkotlinx/serialization/json/JsonElement;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/message/MessageOrigin$Unknown; public fun equals (Ljava/lang/Object;)Z public fun getDate ()Ldev/inmo/tgbotapi/types/TelegramDate; public final fun getSource ()Lkotlinx/serialization/json/JsonElement; @@ -28365,8 +28264,6 @@ public final class dev/inmo/tgbotapi/types/polls/UnknownPollType : dev/inmo/tgbo public final fun component6 ()Z public final fun component7 ()Z public final fun component8 ()Lkotlinx/serialization/json/JsonElement; - public final fun copy-KILYFNk (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/util/List;ZZLkotlinx/serialization/json/JsonElement;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; - public static synthetic fun copy-KILYFNk$default (Ldev/inmo/tgbotapi/types/polls/UnknownPollType;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/util/List;ZZLkotlinx/serialization/json/JsonElement;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/polls/UnknownPollType; public fun equals (Ljava/lang/Object;)Z public fun getId-S5FO_mE ()Ljava/lang/String; public fun getOptions ()Ljava/util/List; @@ -30794,6 +30691,13 @@ public final class dev/inmo/tgbotapi/utils/JSONKt { public static final fun withoutNulls (Lkotlinx/serialization/json/JsonObject;)Lkotlinx/serialization/json/JsonObject; } +public final class dev/inmo/tgbotapi/utils/LaunchWithBotLoggerKt { + public static final fun launchWithBotLogger (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/CoroutineContext;Lkotlinx/coroutines/CoroutineStart;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Job; + public static synthetic fun launchWithBotLogger$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/CoroutineContext;Lkotlinx/coroutines/CoroutineStart;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/Job; + public static final fun subscribeWithBotLogger (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Job; + public static synthetic fun subscribeWithBotLogger$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/Job; +} + public final class dev/inmo/tgbotapi/utils/LongRGBAFromHEXAColorSerializer : kotlinx/serialization/KSerializer { public static final field INSTANCE Ldev/inmo/tgbotapi/utils/LongRGBAFromHEXAColorSerializer; public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/exceptions/RequestException.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/exceptions/RequestException.kt index ddf2da86ab..bce5c8b3e6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/exceptions/RequestException.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/exceptions/RequestException.kt @@ -1,10 +1,13 @@ +@file:OptIn(ExperimentalCoroutinesApi::class) + package dev.inmo.tgbotapi.bot.exceptions import korlibs.time.DateTime import dev.inmo.tgbotapi.types.Response import dev.inmo.tgbotapi.types.RetryAfterError -import io.ktor.utils.io.errors.IOException import kotlinx.coroutines.CopyableThrowable +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.io.IOException fun newRequestException( response: Response, @@ -42,7 +45,7 @@ class CommonBotException(message: String = "Something went wrong", cause: Throwa override fun createCopy(): BotException = CommonBotException(message!!, cause) } -sealed class RequestException constructor( +sealed class RequestException ( val response: Response, val plainAnswer: String, message: String? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt index 0c5a507fef..fb4d680c97 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt @@ -18,6 +18,7 @@ import kotlinx.serialization.json.Json * * On JS, JVM and MingwX64 platforms it is [dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor] * * On LinuxX64 it is [dev.inmo.tgbotapi.bot.ktor.base.MultipleClientKtorRequestsExecutor] */ +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") expect class KtorRequestsExecutor internal constructor( telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, client: HttpClient, @@ -52,5 +53,5 @@ fun KtorRequestsExecutor( jsonFormatter = jsonFormatter, pipelineStepsHolder = pipelineStepsHolder, logger = logger, - diff = kotlin.Unit, + diff = Unit, ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt index e9c849bba4..af0521f3c9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/AbstractRequestCallFactory.kt @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.bot.ktor.base import dev.inmo.kslog.common.KSLog import dev.inmo.kslog.common.v import dev.inmo.kslog.common.w -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory import dev.inmo.tgbotapi.bot.exceptions.newRequestException import dev.inmo.tgbotapi.requests.GetUpdatesRequest @@ -73,7 +72,7 @@ abstract class AbstractRequestCallFactory( val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content) logger.v { "Answer as json for $request: $responseObject" } - return runCatchingSafely { + return runCatching { (responseObject.result?.let { jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it) } ?: response.let { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor.kt index cd6a745ff8..670cbf6215 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DefaultKtorRequestsExecutor.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.bot.ktor.base import dev.inmo.kslog.common.* -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.bot.BaseRequestsExecutor import dev.inmo.tgbotapi.bot.exceptions.BotException import dev.inmo.tgbotapi.bot.exceptions.CommonBotException @@ -83,7 +82,7 @@ class DefaultKtorRequestsExecutor internal constructor( when (e) { is ClientRequestException -> { - val exceptionResult = runCatchingSafely { + val exceptionResult = runCatching { val content = e.response.bodyAsText() val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content) newRequestException( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt index df3c7ea281..4a1f3a5d54 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt @@ -24,11 +24,12 @@ object DownloadFileChannelRequestCallFactory : KtorCallFactory { ): T? = (request as? DownloadFileStream) ?.let { val fullUrl = urlsKeeper.createFileLinkUrl(it.filePath) + @Suppress("UNCHECKED_CAST") ByteReadChannelAllocator { val scope = CoroutineScope(currentCoroutineContext() + SupervisorJob()) val outChannel = ByteChannel() scope.launch { - runCatchingSafely { + runCatching { val response = client.get(fullUrl) val channel: ByteReadChannel = response.bodyAsChannel() channel.copyAndClose(outChannel) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt index 593ffcb226..1b77b10a71 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt @@ -21,9 +21,7 @@ object DownloadFileRequestCallFactory : KtorCallFactory { ): T? = (request as? DownloadFile)?.let { val fullUrl = urlsKeeper.createFileLinkUrl(it.filePath) - safely { - @Suppress("UNCHECKED_CAST") - client.get(fullUrl).readRawBytes() as T // always ByteArray - } + @Suppress("UNCHECKED_CAST") + client.get(fullUrl).readRawBytes() as T // always ByteArray } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/MultipleClientKtorRequestsExecutor.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/MultipleClientKtorRequestsExecutor.kt index 05bb7d18ba..ba601671ac 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/MultipleClientKtorRequestsExecutor.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/MultipleClientKtorRequestsExecutor.kt @@ -1,7 +1,6 @@ package dev.inmo.tgbotapi.bot.ktor.base import dev.inmo.kslog.common.KSLog -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.bot.BaseRequestsExecutor import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory import dev.inmo.tgbotapi.bot.ktor.TelegramBotPipelinesHandler @@ -107,7 +106,7 @@ class MultipleClientKtorRequestsExecutor( private suspend fun withRequestExecutor(block: suspend (DefaultKtorRequestsExecutor) -> T): T { val requestsExecutor = prepareRequestsExecutor() - val result = runCatchingSafely { + val result = runCatching { block(requestsExecutor) } freeRequestsExecutor(requestsExecutor) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware.kt index a4221a362f..8d76032fbe 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/middlewares/TelegramBotMiddleware.kt @@ -35,6 +35,7 @@ open class TelegramBotMiddleware( ) : TelegramBotPipelinesHandler { object ResultAbsence : Throwable() override suspend fun onRequestException(request: Request, t: Throwable): T? { + @Suppress("UNCHECKED_CAST") return onRequestException ?.invoke(request, t) as? T } @@ -51,6 +52,7 @@ open class TelegramBotMiddleware( request: Request, potentialFactory: KtorCallFactory ): T? { + @Suppress("UNCHECKED_CAST") return onAfterCallFactoryMakeCall ?.invoke(result, request, potentialFactory) as? T } @@ -60,6 +62,7 @@ open class TelegramBotMiddleware( resultCallFactory: KtorCallFactory, callsFactories: List ): T? { + @Suppress("UNCHECKED_CAST") return onRequestResultPresented ?.invoke(result, request, resultCallFactory, callsFactories) as? T } @@ -67,6 +70,7 @@ open class TelegramBotMiddleware( request: Request, callsFactories: List ): T? { + @Suppress("UNCHECKED_CAST") return onRequestResultAbsent ?.invoke(request, callsFactories) as? T } @@ -75,6 +79,7 @@ open class TelegramBotMiddleware( request: Request, callsFactories: List ): Result { + @Suppress("UNCHECKED_CAST") return onRequestReturnResult ?.invoke(result, request, callsFactories) as? Result ?: Result.failure(ResultAbsence) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/ExceptionsOnlyLimiter.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/ExceptionsOnlyLimiter.kt index 92c63af69d..0bf389386b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/ExceptionsOnlyLimiter.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/ExceptionsOnlyLimiter.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.bot.settings.limiters -import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.bot.exceptions.TooMuchRequestsException import kotlinx.coroutines.delay @@ -11,7 +10,7 @@ object ExceptionsOnlyLimiter : RequestLimiter { override suspend fun limit(block: suspend () -> T): T { var result: Result? = null while (result == null || result.isFailure) { - result = runCatchingSafely { + result = runCatching { block() }.onFailure { if (it is TooMuchRequestsException) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/PowLimiter.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/PowLimiter.kt index bb20345101..fc9f3d7497 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/PowLimiter.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/settings/limiters/PowLimiter.kt @@ -1,7 +1,8 @@ +@file:Suppress("unused", "RemoveExplicitTypeArguments") + package dev.inmo.tgbotapi.bot.settings.limiters import dev.inmo.micro_utils.coroutines.actor -import dev.inmo.micro_utils.coroutines.safely import dev.inmo.tgbotapi.types.MilliSeconds import kotlinx.coroutines.* import kotlinx.serialization.Serializable @@ -56,7 +57,7 @@ data class PowLimiter( } delay(delayMillis) return try { - safely { block() } + block() } finally { eventsChannel.send(CompleteRequest) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt index 34a6deb85f..ecab9848e9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/SetPassportDataErrors.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.builtins.serializer @Serializable data class SetPassportDataErrors( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val user: UserId, @SerialName(errorsField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt index b382b40c95..5d2b1e7b56 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/abstracts/InputFile.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("DEPRECATION") // for io.ktor.utils.io.core.ByteReadPacket + package dev.inmo.tgbotapi.requests.abstracts import com.benasher44.uuid.uuid4 @@ -70,6 +73,7 @@ internal inline val InputFile.fileIdToSend /** * Contains file id or file url */ +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(InputFileSerializer::class) data class FileId( override val fileId: String @@ -92,6 +96,7 @@ object InputFileSerializer : KSerializer { * * @see asMultipartFile */ +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(InputFileSerializer::class) data class MultipartFile ( val filename: String, @@ -126,5 +131,5 @@ suspend inline fun ByteReadChannelAllocator.asMultipartFile( ) = this.invoke().asMultipartFile(fileName) expect fun MPPFile.asMultipartFile(): MultipartFile -@Suppress("NOTHING_TO_INLINE") +@Suppress("NOTHING_TO_INLINE", "unused") inline fun MPPFile.multipartFile() = asMultipartFile() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton.kt index 4cc8bf71b0..b47a4502cd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/answers/InlineQueryResultsButton.kt @@ -1,7 +1,5 @@ package dev.inmo.tgbotapi.requests.answers -import dev.inmo.micro_utils.common.Warning -import dev.inmo.tgbotapi.types.StartParameter import dev.inmo.tgbotapi.types.startParameterField import dev.inmo.tgbotapi.types.textField import dev.inmo.tgbotapi.types.webAppField @@ -29,6 +27,7 @@ sealed interface InlineQueryResultsButton { val deepLinkParameter: String? = null ) + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(InlineQueryResultsButtonSerializer::class) data class WebApp( @SerialName(textField) @@ -37,6 +36,7 @@ sealed interface InlineQueryResultsButton { val webAppInfo: WebAppInfo ) : InlineQueryResultsButton + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(InlineQueryResultsButtonSerializer::class) data class Start( @SerialName(textField) @@ -45,6 +45,8 @@ sealed interface InlineQueryResultsButton { val deepLinkParameter: String ) : InlineQueryResultsButton + @ConsistentCopyVisibility + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(InlineQueryResultsButtonSerializer::class) data class Unknown internal constructor ( @SerialName(textField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/InputProfilePhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/InputProfilePhoto.kt index f1bf91bb62..8524ebfa40 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/InputProfilePhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/InputProfilePhoto.kt @@ -1,14 +1,14 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.requests.business_connection import dev.inmo.tgbotapi.requests.abstracts.MultipartFile import dev.inmo.tgbotapi.types.DoubleSeconds -import dev.inmo.tgbotapi.types.Seconds -import dev.inmo.tgbotapi.types.StickerFormat import dev.inmo.tgbotapi.types.animationField import dev.inmo.tgbotapi.types.mainFrameTimestampField import dev.inmo.tgbotapi.types.photoField -import dev.inmo.tgbotapi.utils.deserializeWithRaw import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -23,6 +23,7 @@ sealed interface InputProfilePhoto { val mediaPair: Pair @Serializable data class Static( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(photoField) val photo: MultipartFile ) : InputProfilePhoto { @@ -33,6 +34,7 @@ sealed interface InputProfilePhoto { } @Serializable data class Animated( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(animationField) val animation: MultipartFile, @SerialName(mainFrameTimestampField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/ReadBusinessMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/ReadBusinessMessage.kt index 71286d3fb3..d5d6c0f206 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/ReadBusinessMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/ReadBusinessMessage.kt @@ -19,6 +19,7 @@ import kotlinx.serialization.builtins.serializer data class ReadBusinessMessage( @SerialName(businessConnectionIdField) override val businessConnectionId: BusinessConnectionId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatIdField) val chatId: ChatId, @SerialName(messageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/SetBusinessAccountProfilePhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/SetBusinessAccountProfilePhoto.kt index c55f828fa4..8b28be5bdb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/SetBusinessAccountProfilePhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/SetBusinessAccountProfilePhoto.kt @@ -2,21 +2,10 @@ package dev.inmo.tgbotapi.requests.business_connection import dev.inmo.tgbotapi.requests.abstracts.BusinessRequest import dev.inmo.tgbotapi.requests.abstracts.MultipartFile -import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest -import dev.inmo.tgbotapi.types.ChatId -import dev.inmo.tgbotapi.types.MessageId -import dev.inmo.tgbotapi.types.Username import dev.inmo.tgbotapi.types.businessConnectionIdField import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId -import dev.inmo.tgbotapi.types.chatIdField -import dev.inmo.tgbotapi.types.firstNameField import dev.inmo.tgbotapi.types.isPublicField -import dev.inmo.tgbotapi.types.lastNameField -import dev.inmo.tgbotapi.types.message.RawMessage -import dev.inmo.tgbotapi.types.messageIdField -import dev.inmo.tgbotapi.types.messageIdsField import dev.inmo.tgbotapi.types.photoField -import dev.inmo.tgbotapi.types.usernameField import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -39,6 +28,7 @@ data class SetBusinessAccountProfilePhoto( override val requestSerializer: SerializationStrategy<*> get() = serializer() + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") override val mediaMap: Map = mapOf( photo.mediaPair ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/TransferGift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/TransferGift.kt index 43b62f684c..91d4fde0a3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/TransferGift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/business_connection/TransferGift.kt @@ -20,6 +20,7 @@ data class TransferGift( override val businessConnectionId: BusinessConnectionId, @SerialName(ownedGiftIdField) val ownedGiftId: GiftId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(newOwnerChatIdField) val newOwnerChatId: ChatId, @SerialName(starCountField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestAnswer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestAnswer.kt index 67285cea62..5f7da48e02 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestAnswer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/ChatJoinRequestAnswer.kt @@ -18,12 +18,13 @@ sealed interface ChatJoinRequestAnswer : SimpleRequest { /** * Represent [approve](https://core.telegram.org/bots/api#approvechatjoinrequest) [ChatJoinRequestAnswer]. You may approve - * the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate]) + * the requests retrieved in with [dev.inmo.tgbotapi.types.chat.ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate]) */ @Serializable data class ApproveChatJoinRequest( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId ) : ChatJoinRequestAnswer { @@ -35,12 +36,13 @@ data class ApproveChatJoinRequest( /** * Represent [decline](https://core.telegram.org/bots/api#declinechatjoinrequest) [ChatJoinRequestAnswer]. You may approve - * the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate]) + * the requests retrieved in with [dev.inmo.tgbotapi.types.chat.ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate]) */ @Serializable data class DeclineChatJoinRequest( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId ) : ChatJoinRequestAnswer { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt index 4b50b7b8df..3211b4a28b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/CreateChatInviteLink.kt @@ -1,7 +1,9 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused") + package dev.inmo.tgbotapi.requests.chat.invite_links import dev.inmo.tgbotapi.abstracts.types.SubscriptionInfo -import dev.inmo.tgbotapi.abstracts.types.SubscriptionPeriodInfo import korlibs.time.DateTime import dev.inmo.tgbotapi.requests.chat.abstracts.* import dev.inmo.tgbotapi.types.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt index 48b95960b2..63955b56af 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/invite_links/EditChatInviteLink.kt @@ -1,7 +1,9 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused") + package dev.inmo.tgbotapi.requests.chat.invite_links import korlibs.time.DateTime -import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.chat.abstracts.* import dev.inmo.tgbotapi.types.* import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatMember.kt index c57c4d6bb9..0a9c97b8d3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatMember.kt @@ -10,6 +10,7 @@ import kotlinx.serialization.builtins.serializer data class BanChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatSenderChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatSenderChat.kt index 1832c60fae..ee0dbc139f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatSenderChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/BanChatSenderChat.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.builtins.serializer data class BanChatSenderChat( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(senderChatIdField) override val senderChatId: IdChatIdentifier ) : ChatSenderRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/GetChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/GetChatMember.kt index 971aa3be74..dcd18f594f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/GetChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/GetChatMember.kt @@ -10,6 +10,7 @@ import kotlinx.serialization.* data class GetChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId ) : ChatMemberRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/PromoteChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/PromoteChatMember.kt index 06f6fe2b48..de3b8d201e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/PromoteChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/PromoteChatMember.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.builtins.serializer data class PromoteChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/RestrictChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/RestrictChatMember.kt index bdb9cc5afe..ce165ffbd6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/RestrictChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/RestrictChatMember.kt @@ -11,6 +11,7 @@ import kotlinx.serialization.builtins.serializer data class RestrictChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/SetChatAdministratorCustomTitle.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/SetChatAdministratorCustomTitle.kt index 9cfcfd2208..0673cecee1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/SetChatAdministratorCustomTitle.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/SetChatAdministratorCustomTitle.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.builtins.serializer data class SetChatAdministratorCustomTitle( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(customTitleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt index afe519c847..1100403f76 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.builtins.serializer data class UnbanChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(onlyIfBannedField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatSenderChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatSenderChat.kt index 324b92a44a..cc1e8a6fda 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatSenderChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatSenderChat.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.builtins.serializer data class UnbanChatSenderChat( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(senderChatIdField) override val senderChatId: IdChatIdentifier ) : ChatSenderRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt index 7678c0ff7a..1c0ccb239e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditChatMessageCaption.kt @@ -56,6 +56,7 @@ fun EditChatMessageCaption( replyMarkup = replyMarkup ) +@ConsistentCopyVisibility @Serializable data class EditChatMessageCaption internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt index 318f71f673..06e4728b7e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/caption/EditInlineMessageCaption.kt @@ -37,6 +37,7 @@ fun EditInlineMessageCaption( replyMarkup ) +@ConsistentCopyVisibility @Serializable data class EditInlineMessageCaption internal constructor( @SerialName(inlineMessageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditChatMessageMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditChatMessageMedia.kt index 632fd01d04..d55f073b5f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditChatMessageMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditChatMessageMedia.kt @@ -23,6 +23,7 @@ data class EditChatMessageMedia( override val chatId: ChatIdentifier, @SerialName(messageIdField) override val messageId: MessageId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(mediaField) override val media: TelegramFreeMedia, @SerialName(businessConnectionIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditInlineMessageMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditInlineMessageMedia.kt index a6a8fecfa6..1662a965cb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditInlineMessageMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/media/EditInlineMessageMedia.kt @@ -11,6 +11,7 @@ import kotlinx.serialization.* data class EditInlineMessageMedia( @SerialName(inlineMessageIdField) override val inlineMessageId: InlineMessageId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(mediaField) override val media: TelegramFreeMedia, @SerialName(replyMarkupField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/payments/EditUserStarSubscription.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/payments/EditUserStarSubscription.kt index 960e4b2f5b..61ea54469c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/payments/EditUserStarSubscription.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/payments/EditUserStarSubscription.kt @@ -14,6 +14,7 @@ import kotlinx.serialization.builtins.serializer @Serializable data class EditUserStarSubscription( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @SerialName(telegramPaymentChargeIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt index d685731601..47420bf48d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditChatMessageText.kt @@ -55,6 +55,7 @@ fun EditChatMessageText( replyMarkup ) +@ConsistentCopyVisibility @Serializable data class EditChatMessageText internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt index a5b6048958..ceadabd6a4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/text/EditInlineMessageText.kt @@ -46,6 +46,7 @@ fun EditInlineMessageText( replyMarkup = replyMarkup ) +@ConsistentCopyVisibility @Serializable data class EditInlineMessageText internal constructor( @SerialName(inlineMessageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByChat.kt index 1d6af75973..7462985827 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByChat.kt @@ -7,8 +7,10 @@ import kotlinx.serialization.* @Serializable data class GetGameHighScoresByChat ( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatIdField) override val chatId: IdChatIdentifier, @SerialName(messageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByInlineMessageId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByInlineMessageId.kt index d8943fb5da..1a00ffa86c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByInlineMessageId.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/GetGameHighScoresByInlineMessageId.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.* @Serializable data class GetGameHighScoresByInlineMessageId ( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(inlineMessageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByChatId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByChatId.kt index cb2cf64cb6..b245b56667 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByChatId.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByChatId.kt @@ -7,10 +7,12 @@ import kotlinx.serialization.* @Serializable data class SetGameScoreByChatId ( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(scoreField) override val score: Long, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatIdField) override val chatId: IdChatIdentifier, @SerialName(messageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByInlineMessageId.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByInlineMessageId.kt index d8279e60be..dd51f9de83 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByInlineMessageId.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/games/SetGameScoreByInlineMessageId.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.* @Serializable data class SetGameScoreByInlineMessageId ( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) override val userId: UserId, @SerialName(scoreField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetCustomEmojiStickers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetCustomEmojiStickers.kt index 8cba482df8..2d58f66f5c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetCustomEmojiStickers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetCustomEmojiStickers.kt @@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.files.StickerSerializer import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer +@Suppress("UNCHECKED_CAST") internal val getCustomEmojiStickersResultSerializer = ListSerializer(StickerSerializer) as DeserializationStrategy> @Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt index 97e74506f6..f3dd762096 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetFile.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.* @Serializable data class GetFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) val fileId: FileId ): SimpleRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserChatBoosts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserChatBoosts.kt index 0e4e08b8de..fe3afcedf4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserChatBoosts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserChatBoosts.kt @@ -13,6 +13,7 @@ import kotlinx.serialization.SerializationStrategy data class GetUserChatBoosts( @SerialName(chatIdField) override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId ) : SimpleRequest, ChatRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserProfilePhotos.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserProfilePhotos.kt index 0151627ddc..5765c882da 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserProfilePhotos.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetUserProfilePhotos.kt @@ -6,6 +6,7 @@ import kotlinx.serialization.* @Serializable data class GetUserProfilePhotos( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @SerialName(offsetField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription.kt index a83f1b88f7..63e4531b12 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/GiftPremiumSubscription.kt @@ -21,8 +21,10 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.builtins.serializer +@ConsistentCopyVisibility @Serializable data class GiftPremiumSubscription internal constructor( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @SerialName(monthCountField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt index 585ea49d90..2406d62566 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/gifts/SendGift.kt @@ -6,7 +6,6 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.asTextSources -import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.toRawMessageEntities import dev.inmo.tgbotapi.utils.extensions.makeSourceString @@ -16,8 +15,10 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.builtins.serializer +@ConsistentCopyVisibility @Serializable data class SendGift internal constructor( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId? = null, @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/inline/SavePreparedInlineMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/inline/SavePreparedInlineMessage.kt index 85f6d85437..a8db4704df 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/inline/SavePreparedInlineMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/inline/SavePreparedInlineMessage.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.SerializationStrategy @Serializable data class SavePreparedInlineMessage( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @Serializable(InlineQueryResultSerializer::class) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt index edca7d0f6e..b7ba7fa756 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/CopyMessage.kt @@ -1,8 +1,9 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.abstracts.TextedOutput import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData -import dev.inmo.tgbotapi.abstracts.WithCustomizableCaption import dev.inmo.tgbotapi.abstracts.types.MessageAction import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest @@ -10,7 +11,6 @@ import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.WithCustomizableCaptionRequest import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.parseModeField @@ -143,6 +143,7 @@ fun CopyMessage( replyMarkup = replyMarkup ) +@ConsistentCopyVisibility @Serializable data class CopyMessage internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt index 871c5288d4..bd1e93ae33 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendMessage.kt @@ -78,6 +78,7 @@ fun SendTextMessage( replyMarkup = replyMarkup ) +@ConsistentCopyVisibility @Serializable data class SendTextMessage internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt index 4be73900fe..6c0bbe7b50 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAnimation.kt @@ -1,3 +1,5 @@ +@file:Suppress("FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.requests.abstracts.* @@ -133,6 +135,7 @@ fun SendAnimation( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendAnimationData internal constructor( @SerialName(chatIdField) @@ -202,6 +205,8 @@ data class SendAnimationData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendAnimationFiles internal constructor( val animation: MultipartFile? = null, val thumbnail: MultipartFile? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt index f2a033ac7b..be6f0124f0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendAudio.kt @@ -1,3 +1,5 @@ +@file:Suppress("FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.abstracts.Performerable @@ -126,6 +128,7 @@ fun SendAudio( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendAudioData internal constructor( @SerialName(chatIdField) @@ -190,6 +193,8 @@ data class SendAudioData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendAudioFiles internal constructor( val audio: MultipartFile? = null, val thumbnail: MultipartFile? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt index 97a1ae866e..f49f4240ec 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendDocument.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused", "FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.requests.abstracts.* @@ -144,6 +146,7 @@ private val commonResultDeserializer: DeserializationStrategy SendMediaGroup( replyParameters = replyParameters ) + @Suppress("UNCHECKED_CAST") return (if (files.isEmpty()) { data } else { @@ -182,6 +185,7 @@ private object MessagesListSerializer: KSerializer>>, SendContentMessageRequest>> { + @Suppress("unused") @SerialName(mediaField) private val convertedMedia: String get() = buildJsonArray { @@ -219,6 +224,8 @@ data class SendMediaGroupData internal constructor( get() = MessagesListSerializer } +@Suppress("unused") +@ConsistentCopyVisibility data class SendMediaGroupFiles internal constructor( val files: List -) : Files by (files.map { it.fileId to it }.toMap()) +) : Files by (files.associateBy { it.fileId }) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPaidMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPaidMedia.kt index 09c0ba2cc7..2db109bd21 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPaidMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPaidMedia.kt @@ -1,3 +1,5 @@ +@file:Suppress("FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.types.media.TelegramPaidMedia @@ -145,12 +147,14 @@ fun SendPaidMedia( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendPaidMediaData internal constructor( @SerialName(chatIdField) override val chatId: ChatIdentifier, @SerialName(starCountField) val starCount: Int, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(mediaField) val media: List, @SerialName(captionField) @@ -204,6 +208,8 @@ data class SendPaidMediaData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendPaidMediaFiles internal constructor( val photo: MultipartFile ) : Files by mapOf( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt index bdb979b57b..d4b7842607 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendPhoto.kt @@ -1,3 +1,5 @@ +@file:Suppress("FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.requests.abstracts.* @@ -109,6 +111,7 @@ fun SendPhoto( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendPhotoData internal constructor( @SerialName(chatIdField) @@ -167,6 +170,8 @@ data class SendPhotoData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendPhotoFiles internal constructor( val photo: MultipartFile ) : Files by mapOf( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt index eb8a8202ab..8d97ba2a54 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendSticker.kt @@ -13,6 +13,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializ import dev.inmo.tgbotapi.types.message.content.StickerContent import kotlinx.serialization.* +@Suppress("FunctionName") fun SendSticker( chatId: ChatIdentifier, sticker: InputFile, @@ -50,6 +51,7 @@ fun SendSticker( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendStickerByFileId internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt index 7beeeb5b26..40df7df3a5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideo.kt @@ -1,3 +1,5 @@ +@file:Suppress("FunctionName") + package dev.inmo.tgbotapi.requests.send.media import dev.inmo.tgbotapi.abstracts.WithCustomStartMediaData @@ -148,6 +150,7 @@ fun SendVideo( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendVideoData internal constructor( @SerialName(chatIdField) @@ -225,6 +228,8 @@ data class SendVideoData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendVideoFiles internal constructor( val video: MultipartFile? = null, val thumbnail: MultipartFile? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt index 9ad7f6ffcb..f88bedadcc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVideoNote.kt @@ -13,6 +13,7 @@ import dev.inmo.tgbotapi.types.message.content.VideoNoteContent import dev.inmo.tgbotapi.utils.mapOfNotNull import kotlinx.serialization.* +@Suppress("FunctionName") fun SendVideoNote( chatId: ChatIdentifier, videoNote: InputFile, @@ -60,6 +61,7 @@ fun SendVideoNote( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendVideoNoteData internal constructor( @SerialName(chatIdField) @@ -105,6 +107,8 @@ data class SendVideoNoteData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendVideoNoteFiles internal constructor( val videoNote: MultipartFile? = null, val thumbnail: MultipartFile? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt index 5a817d7125..68f3e8bd2a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/media/SendVoice.kt @@ -111,6 +111,7 @@ fun SendVoice( private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +@ConsistentCopyVisibility @Serializable data class SendVoiceData internal constructor( @SerialName(chatIdField) @@ -166,6 +167,8 @@ data class SendVoiceData internal constructor( get() = serializer() } +@Suppress("unused") +@ConsistentCopyVisibility data class SendVoiceFiles internal constructor( val voice: MultipartFile? = null, val thumbnail: MultipartFile? = null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/RefundStarPayment.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/RefundStarPayment.kt index 01812079e5..d53a39b3f1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/RefundStarPayment.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/RefundStarPayment.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.builtins.serializer @Serializable data class RefundStarPayment( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @SerialName(telegramPaymentChargeIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt index 0b8ca7d00e..ea3697c4f1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/payments/SendInvoice.kt @@ -5,7 +5,6 @@ import dev.inmo.tgbotapi.abstracts.types.* import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyWithEffectRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass @@ -24,6 +23,7 @@ private val invoiceMessageSerializer: DeserializationStrategy { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt index 2cd9f3cd8b..3ad566ef36 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stickers/InputSticker.kt @@ -117,6 +117,7 @@ object InputStickerSerializer : KSerializer, MapperSerializer { - init { - // TODO:: add check of width/height of image and type of file - it must be png with max side length is 512px - } - + // TODO:: add check of width/height of image and type of file - it must be png with max side length is 512px override fun method(): String = "uploadStickerFile" @Transient override val mediaMap: Map = mapOf(stickerField to sticker) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/EditStory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/EditStory.kt index ba6a68553d..32106e21aa 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/EditStory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/EditStory.kt @@ -3,10 +3,7 @@ package dev.inmo.tgbotapi.requests.stories import dev.inmo.tgbotapi.abstracts.TextedOutput import dev.inmo.tgbotapi.requests.abstracts.BusinessRequest import dev.inmo.tgbotapi.requests.abstracts.MultipartFile -import dev.inmo.tgbotapi.requests.stories.PostStory -import dev.inmo.tgbotapi.types.Seconds import dev.inmo.tgbotapi.types.StoryId -import dev.inmo.tgbotapi.types.activePeriodField import dev.inmo.tgbotapi.types.areasField import dev.inmo.tgbotapi.types.businessConnectionIdField import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId @@ -31,6 +28,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy +@ConsistentCopyVisibility @Serializable data class EditStory private constructor( @SerialName(businessConnectionIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/PostStory.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/PostStory.kt index 417c8d4436..d38e154827 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/PostStory.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/stories/PostStory.kt @@ -28,6 +28,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy +@ConsistentCopyVisibility @Serializable data class PostStory private constructor( @SerialName(businessConnectionIdField) @@ -120,6 +121,7 @@ data class PostStory private constructor( override fun method(): String = "postStory" + @Suppress("unused") companion object { const val ACTIVE_PERIOD_6_HOURS: Seconds = 6 * 3600 const val ACTIVE_PERIOD_12_HOURS: Seconds = 12 * 3600 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt index 594364eabe..b6ff8adb54 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/RemoveUserVerification.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.requests.verifications -import dev.inmo.tgbotapi.abstracts.types.ChatRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import kotlinx.serialization.DeserializationStrategy @@ -9,9 +8,9 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.builtins.serializer - @Serializable data class RemoveUserVerification( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, ): SimpleRequest { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt index 235d38f969..ffdd9c4e4b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/verifications/VerifyUser.kt @@ -1,6 +1,5 @@ package dev.inmo.tgbotapi.requests.verifications -import dev.inmo.tgbotapi.abstracts.types.ChatRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.types.* import kotlinx.serialization.DeserializationStrategy @@ -12,6 +11,7 @@ import kotlinx.serialization.builtins.serializer @Serializable data class VerifyUser( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId, @SerialName(customDescriptionField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/webhook/SetWebhook.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/webhook/SetWebhook.kt index 774e7ae80f..950f898bc7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/webhook/SetWebhook.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/webhook/SetWebhook.kt @@ -124,6 +124,7 @@ fun SetWebhook( * If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the [url], * e.g. https://www.example.com/. Since nobody else knows your bot's token, you can be pretty sure it's us. */ +@ConsistentCopyVisibility @Serializable data class SetWebhook internal constructor( @SerialName(urlField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundFill.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundFill.kt index a6e19c4cff..4ce052b70e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundFill.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundFill.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types import dev.inmo.micro_utils.colors.common.HEXAColor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundType.kt index a0d4ad891c..26988c5768 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/BackgroundType.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types import dev.inmo.micro_utils.common.Progress @@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.utils.IntProgress100Serializer import dev.inmo.tgbotapi.utils.decodeDataAndJson import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index 85cbc038fa..a8b2d49a3c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types import dev.inmo.micro_utils.common.Warning @@ -26,9 +28,10 @@ sealed interface ChatIdentifier /** * Also used as User Identifier */ +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatIdentifierSerializer::class) sealed interface IdChatIdentifier : ChatIdentifier { - abstract val chatId: RawChatId + val chatId: RawChatId val threadId: MessageThreadId? get() = null val businessConnectionId: BusinessConnectionId? @@ -45,10 +48,12 @@ sealed interface IdChatIdentifier : ChatIdentifier { } } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatIdentifierSerializer::class) @JvmInline value class ChatId(override val chatId: RawChatId) : IdChatIdentifier +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatIdentifierSerializer::class) @JvmInline value class ChatIdWithThreadId(val chatIdWithThreadId: Pair) : IdChatIdentifier { @@ -59,6 +64,7 @@ value class ChatIdWithThreadId(val chatIdWithThreadId: Pair) : IdChatIdentifier { @@ -116,6 +122,7 @@ fun Byte.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId() * @property full The full username string, guaranteed to start with "@". * @throws IllegalArgumentException if the provided [full] value doesn't start with "@" during initialization. */ +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE", "RemoveRedundantQualifierName") @Serializable(ChatIdentifierSerializer::class) @JvmInline value class Username ( @@ -193,6 +200,7 @@ object ChatIdentifierSerializer : KSerializer { } } +@Suppress("unused") @RiskFeature object FullChatIdentifierSerializer : KSerializer { private val internalSerializer = JsonPrimitive.serializer() @@ -216,7 +224,7 @@ object FullChatIdentifierSerializer : KSerializer { val (chatId, _, businessConnectionId) = splitted BusinessChatId( chatId.toLongOrNull() ?.let(::RawChatId) ?: return@let null, - businessConnectionId.let(::BusinessConnectionId) ?: return@let null + businessConnectionId.let(::BusinessConnectionId) ) } else -> null diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt index 9a1f7f0ec6..bdb668cee2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatInviteLink.kt @@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.types import korlibs.time.DateTime import dev.inmo.tgbotapi.abstracts.WithUser import dev.inmo.tgbotapi.abstracts.types.SubscriptionInfo -import dev.inmo.tgbotapi.abstracts.types.SubscriptionPeriodInfo import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.TimeSpanAsSecondsSerializer @@ -67,6 +66,7 @@ sealed interface ChatInviteLink : WithUser { /** * Base interface for all [ChatInviteLink]s which are NOT [PrimaryInviteLink] */ +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatInviteLinkSerializer::class) sealed interface SecondaryChatInviteLink : ChatInviteLink, SubscriptionInfo { override val isPrimary: Boolean @@ -96,7 +96,7 @@ data class PrimaryInviteLink( /** * Represent [SecondaryChatInviteLink] which will require an aprovement from one of the administrators * - * @see ChatJoinRequest + * @see dev.inmo.tgbotapi.types.chat.ChatJoinRequest * @see dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate */ @Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Contact.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Contact.kt index 8eaf9dfb84..285da22024 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Contact.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Contact.kt @@ -12,6 +12,7 @@ data class Contact( override val firstName: String, @SerialName(lastNameField) override val lastName: String? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId? = null, @SerialName(vcardField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt index f9bee204c4..6057258721 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -41,10 +43,12 @@ fun InlineQueryResultAudioCachedImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultAudioCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(audioFileIdField) override val fileId: FileId, @SerialName(captionField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt index 474c7c8764..5d1d4c6ae6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultAudioImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -49,6 +51,7 @@ fun InlineQueryResultAudioImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultAudioImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt index 812e324cdf..06afdf3074 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentCachedImpl.kt @@ -47,10 +47,12 @@ fun InlineQueryResultDocumentCachedImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultDocumentCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(documentFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt index 8ffacd1f0d..6234c71525 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultDocumentImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -59,6 +61,7 @@ fun InlineQueryResultDocumentImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultDocumentImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt index 2ed6956f97..7b8c3e80d5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -57,10 +59,12 @@ fun InlineQueryResultGifCachedImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultGifCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(gifFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt index cc33e87a85..e08d78ac77 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultGifImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -136,6 +138,7 @@ fun InlineQueryResultGifImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultGifImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt index 566c0dd3ae..02ea7c7769 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -57,10 +59,12 @@ fun InlineQueryResultMpeg4GifCachedImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultMpeg4GifCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(mpeg4GifFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt index 8662aa9ec2..1ceccd6769 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultMpeg4GifImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -77,6 +79,7 @@ fun InlineQueryResultMpeg4GifImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultMpeg4GifImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt index 5b6d1073b4..1c82875056 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -61,10 +63,12 @@ fun InlineQueryResultPhotoCachedImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultPhotoCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(photoFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt index 70414e70ab..a56a1f848c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultPhotoImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -72,6 +74,7 @@ fun InlineQueryResultPhotoImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultPhotoImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt index 719fcab14b..8999240166 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultStickerCached.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.Serializable data class InlineQueryResultStickerCached( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(stickerFileIdField) override val fileId: FileId, @SerialName(replyMarkupField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt index eb158461b6..10c68c527d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -61,10 +63,12 @@ fun InlineQueryResultVideoCachedImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultVideoCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(videoFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt index cf2d23abe4..2dfbacccff 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVideoImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -81,6 +83,7 @@ fun InlineQueryResultVideoImpl( inputMessageContent = inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultVideoImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt index 4090627ce0..72fc540df5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceCachedImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -44,10 +46,12 @@ fun InlineQueryResultVoiceCachedImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultVoiceCachedImpl internal constructor( @SerialName(idField) override val id: InlineQueryId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(voiceFileIdField) override val fileId: FileId, @SerialName(titleField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt index 9b3190d9fa..3603f3a99c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/InlineQueryResultVoiceImpl.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult import dev.inmo.tgbotapi.types.* @@ -56,6 +58,7 @@ fun InlineQueryResultVoiceImpl( inputMessageContent ) +@ConsistentCopyVisibility @Serializable data class InlineQueryResultVoiceImpl internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt index f012070487..23feafc083 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InlineQueryResult/serializers/InlineQueryResultSerializer.kt @@ -3,12 +3,14 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.* import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.utils.RiskFeature +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder +@OptIn(ExperimentalSerializationApi::class) @RiskFeature object InlineQueryResultSerializer : KSerializer { @OptIn(InternalSerializationApi::class) @@ -39,6 +41,6 @@ object InlineQueryResultSerializer : KSerializer { } override fun deserialize(decoder: Decoder): InlineQueryResult { - throw TODO() + throw NotImplementedError("Object can't be deserialized") } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt index c09581176e..c0f3c21057 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent import dev.inmo.tgbotapi.abstracts.TextedOutput @@ -30,6 +32,7 @@ fun InputTextMessageContent( linkPreviewOptions: LinkPreviewOptions? = null ) = InputTextMessageContent(entities.makeString(), null, entities.toRawMessageEntities(), linkPreviewOptions) +@ConsistentCopyVisibility @Serializable data class InputTextMessageContent internal constructor( @SerialName(messageTextField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt index ec0efd2cdd..8e0796fa64 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/InlineQueries/InputMessageContentSerializer.kt @@ -1,7 +1,10 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.InlineQueries import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.* import dev.inmo.tgbotapi.utils.RiskFeature +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.* @@ -19,7 +22,6 @@ object InputMessageContentSerializer : KSerializer { is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value) is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value) is InputInvoiceMessageContent -> InputInvoiceMessageContent.serializer().serialize(encoder, value) - else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent") } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/LinkPreviewOptions.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/LinkPreviewOptions.kt index 5890f7d686..3f032fcd21 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/LinkPreviewOptions.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/LinkPreviewOptions.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("RemoveRedundantQualifierName") + package dev.inmo.tgbotapi.types import kotlinx.serialization.* @@ -13,6 +16,7 @@ sealed interface LinkPreviewOptions { val preferLargeMedia: Boolean val showAboveText: Boolean + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(LinkPreviewOptions.Companion::class) data object Disabled : LinkPreviewOptions { @Required @@ -29,6 +33,7 @@ sealed interface LinkPreviewOptions { get() = false } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(LinkPreviewOptions.Companion::class) data class Large( @SerialName(urlField) @@ -48,6 +53,7 @@ sealed interface LinkPreviewOptions { get() = false } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(LinkPreviewOptions.Companion::class) data class Small( @SerialName(urlField) @@ -67,6 +73,7 @@ sealed interface LinkPreviewOptions { get() = false } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(LinkPreviewOptions.Companion::class) data class Default( @SerialName(urlField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MenuButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MenuButton.kt index d7395598e2..539a58c7fb 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MenuButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/MenuButton.kt @@ -64,7 +64,6 @@ internal data class MenuButtonSurrogate( val srcJsonElement: JsonElement? = null ) -@Serializer(MenuButton::class) object MenuButtonSerializer : KSerializer { override val descriptor: SerialDescriptor get() = MenuButtonSurrogate.serializer().descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyInfo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyInfo.kt index 222041fdbd..5dfbfab319 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyInfo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyInfo.kt @@ -1,3 +1,5 @@ +@file:Suppress("RemoveRedundantQualifierName") + package dev.inmo.tgbotapi.types import dev.inmo.tgbotapi.abstracts.SpoilerableData @@ -52,11 +54,13 @@ sealed interface ReplyInfo { @Serializable data class Text( override val origin: MessageOrigin, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") override val chat: SuperPublicChat?, override val messageMeta: Message.MetaInfo?, val linkPreviewOptions: LinkPreviewOptions? ) : External + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(External.Companion::class) sealed interface Content : External { val content: ContentVariant @@ -65,6 +69,7 @@ sealed interface ReplyInfo { @Serializable data class Simple( override val origin: MessageOrigin, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") override val chat: SuperPublicChat?, override val messageMeta: Message.MetaInfo?, override val content: ContentVariant @@ -73,6 +78,7 @@ sealed interface ReplyInfo { @Serializable data class Media( override val origin: MessageOrigin, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") override val chat: SuperPublicChat?, override val messageMeta: Message.MetaInfo?, override val spoilered: Boolean, @@ -83,6 +89,7 @@ sealed interface ReplyInfo { @Serializable private data class Surrogate( val origin: MessageOrigin, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") val chat: SuperPublicChat? = null, val message_id: MessageId? = null, val link_preview_options: LinkPreviewOptions? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt index cd3d451474..cb04431eb3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt @@ -13,6 +13,7 @@ import dev.inmo.tgbotapi.utils.extensions.makeSourceString import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +@ConsistentCopyVisibility @Serializable data class ReplyParameters internal constructor( @SerialName(chatIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ResponseParametersRaw.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ResponseParametersRaw.kt index 631127939f..f9b1ca65f6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ResponseParametersRaw.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ResponseParametersRaw.kt @@ -5,6 +5,7 @@ import kotlinx.serialization.* @Serializable data class ResponseParametersRaw( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName("migrate_to_chat_id") private val migrateToChatId: IdChatIdentifier? = null, @SerialName("retry_after") @@ -14,8 +15,8 @@ data class ResponseParametersRaw( private val createTime: Long = DateTime.now().unixMillisLong val error: RequestError? by lazy { when { - migrateToChatId != null -> MigrateChatId(migrateToChatId); - retryAfter != null -> RetryAfterError(retryAfter, createTime); + migrateToChatId != null -> MigrateChatId(migrateToChatId) + retryAfter != null -> RetryAfterError(retryAfter, createTime) else -> null } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TextQuote.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TextQuote.kt index 2d2f639d16..68385c17a0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TextQuote.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/TextQuote.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlin.jvm.JvmName +@ConsistentCopyVisibility @Serializable data class TextQuote private constructor( @SerialName(textField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt index 11a2349bb3..82f86e75d7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/actions/BotAction.kt @@ -1,3 +1,5 @@ +@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE", "unused") + package dev.inmo.tgbotapi.types.actions import dev.inmo.micro_utils.common.Warning @@ -53,7 +55,7 @@ object TypingAction : BotAction { } inline val typing get() = TypingAction -inline fun BotAction.asTyping() = this as? TypingAction +fun BotAction.asTyping() = this as? TypingAction /** * Will notify user that bot is uploading some photo @@ -64,7 +66,7 @@ object UploadPhotoAction : BotAction { } inline val uploadPhoto get() = UploadPhotoAction -inline fun BotAction.asUploadPhoto() = this as? UploadPhotoAction +fun BotAction.asUploadPhoto() = this as? UploadPhotoAction /** * Will notify user that bot is recording some video @@ -75,7 +77,7 @@ object RecordVideoAction : BotAction { } inline val recordVideo get() = RecordVideoAction -inline fun BotAction.asRecordVideo() = this as? RecordVideoAction +fun BotAction.asRecordVideo() = this as? RecordVideoAction /** * Will notify user that bot is uploading some photo @@ -86,7 +88,7 @@ object UploadVideoAction : BotAction { } inline val uploadVideo get() = UploadVideoAction -inline fun BotAction.asUploadVideo() = this as? UploadVideoAction +fun BotAction.asUploadVideo() = this as? UploadVideoAction /** * Will notify user that bot is recording some audio @@ -97,7 +99,7 @@ object RecordVoiceAction : BotAction { } inline val recordVoice get() = RecordVoiceAction -inline fun BotAction.asRecordVoice() = this as? RecordVoiceAction +fun BotAction.asRecordVoice() = this as? RecordVoiceAction /** * Will notify user that bot is uploading some audio @@ -108,7 +110,7 @@ object UploadVoiceAction : BotAction { } inline val uploadVoice get() = UploadVoiceAction -inline fun BotAction.asUploadVoice() = this as? UploadVoiceAction +fun BotAction.asUploadVoice() = this as? UploadVoiceAction /** * Will notify user that bot is uploading some document @@ -119,7 +121,7 @@ object UploadDocumentAction : BotAction { } inline val uploadDocument get() = UploadDocumentAction -inline fun BotAction.asUploadDocument() = this as? UploadDocumentAction +fun BotAction.asUploadDocument() = this as? UploadDocumentAction /** * Will notify user that bot is trying to find location @@ -130,7 +132,7 @@ object FindLocationAction : BotAction { } inline val findLocation get() = FindLocationAction -inline fun BotAction.asFindLocation() = this as? FindLocationAction +fun BotAction.asFindLocation() = this as? FindLocationAction /** * Will notify user that bot is recording video note @@ -141,7 +143,7 @@ object RecordVideoNoteAction : BotAction { } inline val recordVideoNote get() = RecordVideoNoteAction -inline fun BotAction.asRecordVideoNote() = this as? RecordVideoNoteAction +fun BotAction.asRecordVideoNote() = this as? RecordVideoNoteAction /** * Will notify user that bot is uploading video note @@ -152,7 +154,7 @@ object UploadVideoNoteAction : BotAction { } inline val uploadVideoNote get() = UploadVideoNoteAction -inline fun BotAction.asUploadVideoNote() = this as? UploadVideoNoteAction +fun BotAction.asUploadVideoNote() = this as? UploadVideoNoteAction /** * Will notify user that bot is uploading video note @@ -163,7 +165,7 @@ object ChooseStickerAction : BotAction { } inline val chooseSticker get() = ChooseStickerAction -inline fun BotAction.asChooseStickerAction() = this as? ChooseStickerAction +fun BotAction.asChooseStickerAction() = this as? ChooseStickerAction @Serializable(BotActionSerializer::class) @Warning("Use this action only in case you are pretty sure that there are no other action for your needs") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/boosts/ChatBoostSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/boosts/ChatBoostSource.kt index cfa4716313..65ac0207f3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/boosts/ChatBoostSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/boosts/ChatBoostSource.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("RemoveRedundantQualifierName", "unused", "SimplifyBooleanWithConstants") + package dev.inmo.tgbotapi.types.boosts import dev.inmo.tgbotapi.abstracts.WithMessageId @@ -10,7 +13,6 @@ import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.JsonDecoder import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.decodeFromJsonElement @Serializable(ChatBoostSource.Companion::class) @ClassCastsIncluded @@ -22,6 +24,7 @@ sealed interface ChatBoostSource { override val user: PreviewUser } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatBoostSource.Companion::class) data class Premium( @SerialName(userField) @@ -37,6 +40,7 @@ sealed interface ChatBoostSource { } } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatBoostSource.Companion::class) data class GiftCode( @SerialName(userField) @@ -52,6 +56,7 @@ sealed interface ChatBoostSource { } } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatBoostSource.Companion::class) sealed interface Giveaway : ChatBoostSource, WithMessageId { val unclaimed: Boolean @@ -123,6 +128,7 @@ sealed interface ChatBoostSource { } } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatBoostSource.Companion::class) data class Unknown( override val sourceName: String, @@ -136,6 +142,7 @@ sealed interface ChatBoostSource { @EncodeDefault @SerialName(sourceField) val sourceName: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) val user: PreviewUser? = null, @SerialName(giveawayMessageIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt index e6226828e2..708d5371d2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.business_connection import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId @@ -28,8 +31,10 @@ sealed interface BusinessConnection : WithBusinessConnectionId { data class Enabled( @SerialName(idField) override val id: BusinessConnectionId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userChatIdField) override val userChatId: ChatId, @SerialName(dateField) @@ -45,8 +50,10 @@ sealed interface BusinessConnection : WithBusinessConnectionId { data class Disabled( @SerialName(idField) override val id: BusinessConnectionId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userChatIdField) override val userChatId: ChatId, @SerialName(dateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt index b9e9f35c2e..b5c0fe7c7e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt @@ -9,8 +9,10 @@ import kotlinx.serialization.Serializable internal data class RawBusinessConnection( @SerialName(idField) val id: BusinessConnectionId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) val user: PreviewUser, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userChatIdField) val userChatId: ChatId, @SerialName(dateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt index 665ef09579..33a22297f8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("KDocUnresolvedReference", "unused") + package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index fb3bfce829..8f6f624a3a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -1,8 +1,11 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt index a51385927b..9fdff29f3d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButton.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused", "KDocUnresolvedReference") + package dev.inmo.tgbotapi.types.buttons import dev.inmo.tgbotapi.types.* @@ -30,6 +33,7 @@ data class SimpleKeyboardButton( override val text: String ) : KeyboardButton +@ConsistentCopyVisibility @Serializable data class UnknownKeyboardButton internal constructor( override val text: String, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt index e84a480e0d..9ebb5584b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt @@ -1,13 +1,15 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.buttons import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.request.RequestId import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import kotlinx.serialization.Serializer import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyForce.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyForce.kt index e5c970e7d2..a40beaff1f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyForce.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyForce.kt @@ -1,3 +1,6 @@ +@file:Suppress("unused") +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.buttons import dev.inmo.tgbotapi.types.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove.kt index aa79b820f8..9e9d8a8c95 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/ReplyKeyboardRemove.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.buttons import kotlinx.serialization.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/inline/InlineKeyboardButtonsShortcuts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/inline/InlineKeyboardButtonsShortcuts.kt index 68c11acf1b..70f1678663 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/inline/InlineKeyboardButtonsShortcuts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/inline/InlineKeyboardButtonsShortcuts.kt @@ -9,14 +9,14 @@ import dev.inmo.tgbotapi.types.webapps.WebAppInfo /** * Creates [PayInlineKeyboardButton] */ -inline fun payInlineButton( +fun payInlineButton( text: String ) = PayInlineKeyboardButton(text) /** * Creates [CallbackDataInlineKeyboardButton] */ -inline fun dataInlineButton( +fun dataInlineButton( text: String, data: String ) = CallbackDataInlineKeyboardButton(text, data) @@ -24,14 +24,14 @@ inline fun dataInlineButton( /** * Creates [CallbackGameInlineKeyboardButton] */ -inline fun gameInlineButton( +fun gameInlineButton( text: String ) = CallbackGameInlineKeyboardButton(text) /** * Creates [LoginURLInlineKeyboardButton] */ -inline fun loginInlineButton( +fun loginInlineButton( text: String, loginUrl: LoginURL ) = LoginURLInlineKeyboardButton(text, loginUrl) @@ -39,7 +39,7 @@ inline fun loginInlineButton( /** * Creates [CopyTextButton] */ -inline fun copyTextButton( +fun copyTextButton( text: String, data: CopyTextButtonData ) = CopyTextButton(text, data) @@ -47,7 +47,7 @@ inline fun copyTextButton( /** * Creates [CopyTextButton] */ -inline fun copyTextButton( +fun copyTextButton( text: String, data: String ) = copyTextButton(text, CopyTextButtonData(data)) @@ -55,7 +55,7 @@ inline fun copyTextButton( /** * Creates [SwitchInlineQueryCurrentChatInlineKeyboardButton] */ -inline fun inlineQueryInCurrentChatInlineButton( +fun inlineQueryInCurrentChatInlineButton( text: String, data: String ) = SwitchInlineQueryCurrentChatInlineKeyboardButton(text, data) @@ -63,7 +63,7 @@ inline fun inlineQueryInCurrentChatInlineButton( /** * Creates [SwitchInlineQueryChosenChatInlineKeyboardButton] */ -inline fun inlineQueryInCurrentChatInlineButton( +fun inlineQueryInCurrentChatInlineButton( text: String, parameters: SwitchInlineQueryChosenChat ) = SwitchInlineQueryChosenChatInlineKeyboardButton(text, parameters) @@ -71,7 +71,7 @@ inline fun inlineQueryInCurrentChatInlineButton( /** * Creates [SwitchInlineQueryChosenChatInlineKeyboardButton] */ -inline fun inlineQueryInCurrentChatInlineButton( +fun inlineQueryInCurrentChatInlineButton( text: String, query: String? = null, allowUsers: Boolean = false, @@ -92,7 +92,7 @@ inline fun inlineQueryInCurrentChatInlineButton( /** * Creates [SwitchInlineQueryChosenChatInlineKeyboardButton] */ -inline fun inlineQueryInAnyCurrentChatInlineButton( +fun inlineQueryInAnyCurrentChatInlineButton( text: String, query: String? = null, ) = inlineQueryInCurrentChatInlineButton(text, query, allowUsers = true, allowBots = true, allowGroups = true, allowChannels = true) @@ -100,7 +100,7 @@ inline fun inlineQueryInAnyCurrentChatInlineButton( /** * Creates [SwitchInlineQueryInlineKeyboardButton] */ -inline fun inlineQueryInlineButton( +fun inlineQueryInlineButton( text: String, data: String ) = SwitchInlineQueryInlineKeyboardButton(text, data) @@ -108,7 +108,7 @@ inline fun inlineQueryInlineButton( /** * Creates [URLInlineKeyboardButton] */ -inline fun urlInlineButton( +fun urlInlineButton( text: String, url: String ) = URLInlineKeyboardButton(text, url) @@ -116,7 +116,7 @@ inline fun urlInlineButton( /** * Creates [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only */ -inline fun webAppInlineButton( +fun webAppInlineButton( text: String, webApp: WebAppInfo ) = WebAppInlineKeyboardButton(text, webApp) @@ -124,7 +124,7 @@ inline fun webAppInlineButton( /** * Creates [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only */ -inline fun webAppInlineButton( +fun webAppInlineButton( text: String, url: String ) = webAppInlineButton(text, WebAppInfo(url)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt index e09e4ac6a7..8c8969d091 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt @@ -1,42 +1,39 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.buttons.reply import dev.inmo.tgbotapi.types.buttons.* import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights import dev.inmo.tgbotapi.types.keyboardButtonRequestUserLimit import dev.inmo.tgbotapi.types.request.RequestId -import dev.inmo.tgbotapi.types.requestNameField -import dev.inmo.tgbotapi.types.requestPhotoField -import dev.inmo.tgbotapi.types.requestUsernameField import dev.inmo.tgbotapi.types.webapps.WebAppInfo -import kotlinx.serialization.SerialName -import kotlin.math.max /** * Creates [SimpleKeyboardButton] */ -inline fun simpleReplyButton( +fun simpleReplyButton( text: String ) = SimpleKeyboardButton(text) /** * Creates [RequestContactKeyboardButton] */ -inline fun requestContactReplyButton( +fun requestContactReplyButton( text: String ) = RequestContactKeyboardButton(text) /** * Creates [RequestLocationKeyboardButton] */ -inline fun requestLocationReplyButton( +fun requestLocationReplyButton( text: String ) = RequestLocationKeyboardButton(text) /** * Creates [RequestPollKeyboardButton] */ -inline fun requestPollReplyButton( +fun requestPollReplyButton( text: String, pollType: KeyboardButtonPollType ) = RequestPollKeyboardButton(text, pollType) @@ -44,7 +41,7 @@ inline fun requestPollReplyButton( /** * Creates [WebAppKeyboardButton] */ -inline fun webAppReplyButton( +fun webAppReplyButton( text: String, webApp: WebAppInfo ) = WebAppKeyboardButton(text, webApp) @@ -52,7 +49,7 @@ inline fun webAppReplyButton( /** * Creates [WebAppKeyboardButton] */ -inline fun webAppReplyButton( +fun webAppReplyButton( text: String, url: String ) = webAppReplyButton(text, WebAppInfo(url)) @@ -61,7 +58,7 @@ inline fun webAppReplyButton( /** * Creates [RequestUserKeyboardButton] */ -inline fun requestUsersReplyButton( +fun requestUsersReplyButton( text: String, requestUser: KeyboardButtonRequestUsers ) = RequestUserKeyboardButton( @@ -72,7 +69,7 @@ inline fun requestUsersReplyButton( /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot] */ -inline fun requestBotsReplyButton( +fun requestBotsReplyButton( text: String, requestId: RequestId, maxCount: Int = keyboardButtonRequestUserLimit.first, @@ -93,7 +90,7 @@ inline fun requestBotsReplyButton( /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common] */ -inline fun requestUsersReplyButton( +fun requestUsersReplyButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -116,7 +113,7 @@ inline fun requestUsersReplyButton( /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common] */ -inline fun requestUserReplyButton( +fun requestUserReplyButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -137,7 +134,7 @@ inline fun requestUserReplyButton( /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any] */ -inline fun requestUsersOrBotsReplyButton( +fun requestUsersOrBotsReplyButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -160,7 +157,7 @@ inline fun requestUsersOrBotsReplyButton( /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any] */ -inline fun requestUserOrBotReplyButton( +fun requestUserOrBotReplyButton( text: String, requestId: RequestId, requestName: Boolean? = null, @@ -180,7 +177,7 @@ inline fun requestUserOrBotReplyButton( /** * Creates [RequestChatKeyboardButton] */ -inline fun requestChatReplyButton( +fun requestChatReplyButton( text: String, requestChat: KeyboardButtonRequestChat ) = RequestChatKeyboardButton( @@ -191,7 +188,7 @@ inline fun requestChatReplyButton( /** * Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat] */ -inline fun requestChatReplyButton( +fun requestChatReplyButton( text: String, requestId: RequestId, isChannel: Boolean? = null, @@ -224,7 +221,7 @@ inline fun requestChatReplyButton( /** * Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Channel] */ -inline fun requestChannelReplyButton( +fun requestChannelReplyButton( text: String, requestId: RequestId, isPublic: Boolean? = null, @@ -254,7 +251,7 @@ inline fun requestChannelReplyButton( /** * Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Group] */ -inline fun requestChannelReplyButton( +fun requestChannelReplyButton( text: String, requestId: RequestId, isForum: Boolean? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt index 0f78a666af..5e6dd6c888 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Abstracts.kt @@ -4,11 +4,13 @@ import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import dev.inmo.tgbotapi.types.* import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface UsernameChat : Chat { val username: Username? } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface PrivateChat : Chat, UsernameChat { override val id: UserId @@ -16,39 +18,48 @@ sealed interface PrivateChat : Chat, UsernameChat { val lastName: String } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface BusinessChat : Chat { override val id: BusinessChatId val original: PrivateChat } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface PublicChat : Chat { val title: String } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface SuperPublicChat : PublicChat, UsernameChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface ChannelChat : SuperPublicChat { override val id: ChatId } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface GroupChat : PublicChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface SupergroupChat : GroupChat, SuperPublicChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface ForumChat : SupergroupChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface PossiblyPremiumChat : Chat { val isPremium: Boolean } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatSerializer::class) sealed interface AbleToAddInAttachmentMenuChat : Chat { val addedToAttachmentMenu: Boolean diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatJoinRequest.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatJoinRequest.kt index 8246c7c016..76a62f6ad5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatJoinRequest.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatJoinRequest.kt @@ -11,10 +11,12 @@ import kotlinx.serialization.Serializable */ @Serializable data class ChatJoinRequest( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatField) val chat: PublicChat, @SerialName(fromField) override val from: User, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userChatIdField) val userChatId: UserId, @SerialName(dateField) @@ -24,6 +26,7 @@ data class ChatJoinRequest( @SerialName(bioField) val bio: String? = null ) : FromUser { + @Suppress("unused") val dateTime: DateTime get() = date.asDate } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt index fdf65e08ba..4ca12b7e8c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatMessageReactionUpdated.kt @@ -22,6 +22,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { val old: List val new: List + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Companion::class) data class ByUser( @SerialName(chatField) @@ -42,6 +43,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { get() = null } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Companion::class) data class ByChat( @SerialName(chatField) @@ -62,6 +64,7 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { get() = null } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Companion::class) data class Unknown( @SerialName(chatField) @@ -82,12 +85,14 @@ sealed interface ChatMessageReactionUpdated : WithPreviewChatAndMessageId { val source: JsonElement? ) : ChatMessageReactionUpdated + @ConsistentCopyVisibility @Serializable data class Surrogate internal constructor( @SerialName(chatField) val chat: PreviewChat, @SerialName(messageIdField) val messageId: MessageId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) val reactedUser: PreviewUser? = null, @SerialName(actorChatField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt index bd8f67f218..b0e5227262 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt @@ -1,3 +1,5 @@ +@file:Suppress("TRANSIENT_IS_REDUNDANT", "unused") + package dev.inmo.tgbotapi.types.chat import dev.inmo.tgbotapi.types.* @@ -152,6 +154,7 @@ interface ChatPermissions { ) private val realSerializer = Granular.serializer() + @Suppress("unused") private val commonSerializer = Common.serializer() override val descriptor: SerialDescriptor get() = realSerializer.descriptor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt index d7f6b23e16..7c65b7d106 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat import dev.inmo.tgbotapi.types.* @@ -17,18 +19,24 @@ private val formatter @Serializable(ChatTypeSerializer::class) sealed class ChatType { abstract val stringified: String + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - object Sender : ChatType() { override val stringified = "sender" } + data object Sender : ChatType() { override val stringified = "sender" } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - object Private : ChatType() { override val stringified = "private" } + data object Private : ChatType() { override val stringified = "private" } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - object Group : ChatType() { override val stringified = "group" } + data object Group : ChatType() { override val stringified = "group" } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - object Supergroup : ChatType() { override val stringified = "supergroup" } + data object Supergroup : ChatType() { override val stringified = "supergroup" } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - object Channel : ChatType() { override val stringified = "channel" } + data object Channel : ChatType() { override val stringified = "channel" } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatTypeSerializer::class) - class Unknown(override val stringified: String) : ChatType() + data class Unknown(override val stringified: String) : ChatType() override fun toString(): String { return stringified @@ -66,7 +74,7 @@ object ChatSerializer : KSerializer { return try { formatter.decodeFromJsonElement(ExtendedChatSerializer, decodedJson) - } catch (e: SerializationException) { + } catch (_: SerializationException) { val type = decodedJson[typeField] ?.jsonPrimitive ?.content ?.asChatType val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true val original = decodedJson[originField] diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt index a2b0dd6cda..2e39f454ad 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Extended.kt @@ -17,14 +17,17 @@ import kotlinx.serialization.json.JsonObject @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedChannelChat due") data class ExtendedChannelChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) override val title: String, @SerialName(acceptedGiftTypesField) override val acceptedGiftTypes: AcceptedGiftTypes, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(activeUsernamesField) override val activeUsernames: List = emptyList(), @SerialName(photoField) @@ -38,6 +41,7 @@ data class ExtendedChannelChatImpl( override val pinnedMessage: Message? = null, @SerialName(canSendPaidMediaField) override val canSendPaidMedia: Boolean = false, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(linkedChatIdField) override val linkedGroupChatId: IdChatIdentifier? = null, @SerialName(hasHiddenMembersField) @@ -65,6 +69,7 @@ data class ExtendedChannelChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedGroupChat due") data class ExtendedGroupChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) @@ -107,12 +112,15 @@ data class ExtendedGroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedPrivateChat due") data class ExtendedPrivateChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: UserId, @SerialName(photoField) override val chatPhoto: ChatPhoto? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(activeUsernamesField) override val activeUsernames: List = emptyList(), @SerialName(firstNameField) @@ -145,6 +153,7 @@ data class ExtendedPrivateChatImpl( override val businessOpeningHours: BusinessOpeningHours? = null, @SerialName(birthdateField) override val birthdate: Birthdate? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(personalChatField) @Serializable(PreviewChatSerializer::class) override val personalChat: PreviewChannelChat? = null, @@ -159,12 +168,15 @@ typealias ExtendedUser = ExtendedPrivateChatImpl @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedSupergroupChat due") data class ExtendedSupergroupChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) override val title: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(activeUsernamesField) override val activeUsernames: List = emptyList(), @SerialName(photoField) @@ -184,6 +196,7 @@ data class ExtendedSupergroupChatImpl( override val slowModeDelay: Long? = null, @SerialName(canSetStickerSetField) override val canSetStickerSet: Boolean = false, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(linkedChatIdField) override val linkedChannelChatId: IdChatIdentifier? = null, @SerialName(locationField) @@ -225,12 +238,15 @@ data class ExtendedSupergroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ExtendedForumChat due") data class ExtendedForumChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: IdChatIdentifier, @SerialName(titleField) override val title: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(activeUsernamesField) override val activeUsernames: List = emptyList(), @SerialName(photoField) @@ -250,6 +266,7 @@ data class ExtendedForumChatImpl( override val slowModeDelay: Long? = null, @SerialName(canSetStickerSetField) override val canSetStickerSet: Boolean = false, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(linkedChatIdField) override val linkedChannelChatId: IdChatIdentifier? = null, @SerialName(locationField) @@ -290,12 +307,14 @@ data class ExtendedForumChatImpl( @Serializable data class ExtendedBot( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: UserId, @SerialName(firstNameField) override val firstName: String, @SerialName(lastNameField) override val lastName: String = "", + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, @SerialName(canJoinGroupsField) @@ -329,8 +348,10 @@ data class ExtendedBot( @Serializable data class ExtendedBusinessChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: BusinessChatId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(originField) override val original: ExtendedPrivateChat ) : ExtendedBusinessChat, ExtendedChat by original diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt index fc6bd47080..090ad7ae1a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ExtendedAbstracts.kt @@ -34,23 +34,27 @@ sealed interface ExtendedChat : Chat { acceptedGiftTypes.premiumSubscription } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedNonBotChat : ExtendedChat { val statusEmojiId: CustomEmojiId? val statusEmojiExpiration: TelegramDate? } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat, ExtendedChatWithUsername { val linkedGroupChatId: IdChatIdentifier? val canSendPaidMedia: Boolean } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedGroupChat : GroupChat, ExtendedPublicChat { val permissions: ChatPermissions } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername, ExtendedNonBotChat { val bio: String @@ -79,6 +83,7 @@ sealed interface ExtendedPublicChat : ExtendedChat, PublicChat, ExtendedNonBotCh val newMembersSeeHistory: Boolean } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, ExtendedChatWithUsername { val slowModeDelay: Long? @@ -105,14 +110,17 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, Ext val isAggressiveAntiSpamEnabled: Boolean } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedForumChat : ExtendedSupergroupChat, ForumChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedChatWithUsername : UsernameChat, ExtendedChat { val activeUsernames: List } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ExtendedChatSerializer.Companion::class) sealed interface ExtendedBusinessChat : BusinessChat, ExtendedChat { override val original: ExtendedPrivateChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt index 9a3c8dc204..50631f0b64 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/Impls.kt @@ -11,6 +11,7 @@ import kotlinx.serialization.Serializable @Serializable @RiskFeature("This class is a subject of changes. It is better to use GroupChat due") data class GroupChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) @@ -20,8 +21,10 @@ data class GroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use PrivateChat due") data class PrivateChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: UserId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, @SerialName(firstNameField) @@ -33,8 +36,10 @@ data class PrivateChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use PrivateChat due") data class BusinessChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: BusinessChatId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(originField) override val original: PreviewPrivateChat ) : PreviewBusinessChat @@ -42,10 +47,12 @@ data class BusinessChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use SupergroupChat due") data class SupergroupChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) override val title: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null ) : PreviewSupergroupChat @@ -53,10 +60,12 @@ data class SupergroupChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ForumChat due") data class ForumChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: IdChatIdentifier, @SerialName(titleField) override val title: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null ) : PreviewForumChat @@ -64,10 +73,12 @@ data class ForumChatImpl( @Serializable @RiskFeature("This class is a subject of changes. It is better to use ChannelChat due") data class ChannelChatImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(idField) override val id: ChatId, @SerialName(titleField) override val title: String, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null ) : PreviewChannelChat @@ -75,22 +86,28 @@ data class ChannelChatImpl( @Serializable(UserSerializer::class) sealed class User : PrivateChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(UserSerializer::class) sealed class PreviewUser : PreviewPrivateChat, User() +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(UserSerializer::class) sealed class Bot : User() +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(UserSerializer::class) sealed class PreviewBot : PreviewUser() @Serializable data class CommonBot( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @SerialName(idField) override val id: UserId, @SerialName(firstNameField) override val firstName: String, @SerialName(lastNameField) override val lastName: String = "", + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, ) : PreviewBot() { @@ -100,11 +117,14 @@ data class CommonBot( @Serializable data class CommonUser( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @SerialName(idField) override val id: UserId, @SerialName(firstNameField) override val firstName: String, @SerialName(lastNameField) override val lastName: String = "", + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) override val username: Username? = null, @SerialName(languageCodeField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/PreviewAbstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/PreviewAbstracts.kt index ad8692bcd1..16c98e720d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/PreviewAbstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/PreviewAbstracts.kt @@ -5,29 +5,38 @@ import kotlinx.serialization.Serializable @Serializable(PreviewChatSerializer::class) sealed interface PreviewChat : Chat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewUsernameChat : PreviewChat, UsernameChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewPrivateChat : PreviewUsernameChat, PrivateChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewBusinessChat : BusinessChat, PreviewChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewPublicChat : PreviewChat, PublicChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewSuperPublicChat : PreviewPublicChat, PreviewUsernameChat, SuperPublicChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewChannelChat : PreviewSuperPublicChat, ChannelChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewGroupChat : PreviewPublicChat, GroupChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewSupergroupChat : PreviewGroupChat, PreviewSuperPublicChat, SupergroupChat +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PreviewChatSerializer::class) sealed interface PreviewForumChat : PreviewSupergroupChat, ForumChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt index 16d2207c81..96bcd1ea87 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* @@ -7,6 +9,7 @@ import kotlinx.serialization.* @Serializable data class AdministratorChatMemberImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, @SerialName(canBeEditedField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated.kt index 09feaab826..f6c4fa0a51 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated.kt @@ -14,6 +14,7 @@ import kotlinx.serialization.Serializable data class ChatMemberUpdated( @SerialName(chatField) override val chat: PreviewChat, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fromField) override val user: PreviewUser, @SerialName(dateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/KickedChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/KickedChatMember.kt index 567678b50a..449341fc55 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/KickedChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/KickedChatMember.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* @@ -7,6 +9,7 @@ import kotlinx.serialization.* @Serializable data class KickedChatMember( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMember.kt index 436a0eb261..155da48160 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMember.kt @@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.types.chat.member import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatMemberSerializer::class) sealed interface LeftChatMember : ChatMember diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt index 3d4b77091d..174da9cf56 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/LeftChatMemberImpl.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* @@ -7,6 +9,7 @@ import kotlinx.serialization.* @Serializable data class LeftChatMemberImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser ) : LeftChatMember { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMember.kt index e11554acb7..1061be5d01 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMember.kt @@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.types.chat.member import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatMemberSerializer::class) sealed interface MemberChatMember : ChatMember diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt index 615882bd1c..a9b9a396b1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/MemberChatMemberImpl.kt @@ -1,13 +1,14 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewUser -import dev.inmo.tgbotapi.types.chat.User -import korlibs.time.DateTime import kotlinx.serialization.* @Serializable data class MemberChatMemberImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser ) : MemberChatMember { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt index fad044dfa0..45e79861d6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt @@ -1,12 +1,15 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewUser -import dev.inmo.tgbotapi.types.chat.User import kotlinx.serialization.* @Serializable data class OwnerChatMember( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @SerialName(userField) override val user: PreviewUser, @SerialName(isAnonymousField) override val isAnonymous: Boolean = false, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt index 5a9612716a..41e20ca455 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt @@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.chat.PreviewUser import dev.inmo.tgbotapi.types.chat.User import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatMemberSerializer::class) sealed interface RestrictedChatMember : ChatMember, UntilDate { companion object { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember.kt index 0aff1393e9..b0e81c7b97 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedMemberChatMember.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* @@ -12,6 +14,7 @@ import kotlinx.serialization.* */ @Serializable data class RestrictedMemberChatMember( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SpecialRightsChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SpecialRightsChatMember.kt index 858b22edff..2f4df50fb0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SpecialRightsChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SpecialRightsChatMember.kt @@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.types.chat.member import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatMemberSerializer::class) sealed interface SpecialRightsChatMember : ChatMember, SpecialChatAdministratorRights diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMember.kt index d70d51a502..f7d3ed6dad 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMember.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.TelegramDate import korlibs.time.DateTime import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(ChatMemberSerializer::class) sealed interface SubscriptionMemberChatMember : MemberChatMember, UntilDate { override val untilDate: TelegramDate diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMemberImpl.kt index dcfb1ddae9..7a5d6b3ee5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/SubscriptionMemberChatMemberImpl.kt @@ -1,13 +1,14 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.chat.member import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewUser -import dev.inmo.tgbotapi.types.chat.User -import korlibs.time.DateTime import kotlinx.serialization.* @Serializable data class SubscriptionMemberChatMemberImpl( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userField) override val user: PreviewUser, @SerialName(untilDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTask.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTask.kt index d587b4ff40..7d80e4dc26 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTask.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTask.kt @@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.checklists import dev.inmo.micro_utils.common.Warning import dev.inmo.tgbotapi.abstracts.TextedInput -import dev.inmo.tgbotapi.abstracts.TitledInput import dev.inmo.tgbotapi.types.TelegramDate import dev.inmo.tgbotapi.types.chat.PreviewUser import dev.inmo.tgbotapi.types.completedByUserField @@ -11,16 +10,12 @@ import dev.inmo.tgbotapi.types.idField import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.RawMessageEntity import dev.inmo.tgbotapi.types.message.asTextSources -import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.textsources.RegularTextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.toRawMessageEntities -import dev.inmo.tgbotapi.types.tasksField import dev.inmo.tgbotapi.types.textEntitiesField import dev.inmo.tgbotapi.types.textField import dev.inmo.tgbotapi.types.textParseModeField -import dev.inmo.tgbotapi.types.titleEntitiesField -import dev.inmo.tgbotapi.types.titleField import dev.inmo.tgbotapi.utils.EntitiesBuilder import dev.inmo.tgbotapi.utils.EntitiesBuilderBody import dev.inmo.tgbotapi.utils.RiskFeature @@ -106,6 +101,7 @@ sealed interface ChecklistTask : TextedInput { } } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Created.Serializer::class) data class Undone( @SerialName(idField) @@ -127,6 +123,7 @@ sealed interface ChecklistTask : TextedInput { ) } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Created.Serializer::class) data class Done( @SerialName(idField) @@ -176,6 +173,7 @@ sealed interface ChecklistTask : TextedInput { val text: String, @SerialName(textEntitiesField) val textSources: List = emptyList(), + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(completedByUserField) val completedByUser: PreviewUser? = null, @SerialName(completionDateField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksAdded.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksAdded.kt index 21ce951edd..30bac6bae4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksAdded.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksAdded.kt @@ -1,21 +1,17 @@ package dev.inmo.tgbotapi.types.checklists import dev.inmo.tgbotapi.types.checklistMessageField -import dev.inmo.tgbotapi.types.markedAsDoneTaskIdsField -import dev.inmo.tgbotapi.types.markedAsNotDoneTaskIdsField import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent -import dev.inmo.tgbotapi.types.message.RawMessage import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage -import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import dev.inmo.tgbotapi.types.message.content.ChecklistContent import dev.inmo.tgbotapi.types.tasksField -import dev.inmo.tgbotapi.types.userField import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable data class ChecklistTasksAdded( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(checklistMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializerClass::class) val checklistMessage: CommonMessage, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksDone.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksDone.kt index 369f1aa67b..63bdf33295 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksDone.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/checklists/ChecklistTasksDone.kt @@ -7,12 +7,12 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import dev.inmo.tgbotapi.types.message.content.ChecklistContent -import dev.inmo.tgbotapi.types.userField import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable data class ChecklistTasksDone( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(checklistMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializerClass::class) val checklistMessage: CommonMessage, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/commands/BotCommandScope.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/commands/BotCommandScope.kt index 9102d43a0a..962d422818 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/commands/BotCommandScope.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/commands/BotCommandScope.kt @@ -1,3 +1,6 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.commands import dev.inmo.tgbotapi.types.* @@ -13,6 +16,7 @@ private class SurrogateBotCommandScope( val type: String, @SerialName(chatIdField) val chatId: ChatIdentifier? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val userId: UserId? = null ) { @@ -63,6 +67,7 @@ sealed interface BotCommandScope { } } +@ConsistentCopyVisibility @Serializable data class UnknownBotCommandScope internal constructor( override val type: String @@ -128,6 +133,7 @@ data class BotCommandScopeChat( @Serializable data class BotCommandScopeChatMember( override val chatId: ChatIdentifier, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") val userId: UserId ) : ChatBotCommandScope { @Required diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt index cd95b96d4d..996486bd25 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/dice/DiceAnimationType.kt @@ -15,42 +15,49 @@ sealed interface DiceAnimationType { val emoji: String val valueLimits: IntRange } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object CubeDiceAnimationType : DiceAnimationType { override val emoji: String = "\uD83C\uDFB2" override val valueLimits: IntRange get() = dartsCubeAndBowlingDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object DartsDiceAnimationType : DiceAnimationType { override val emoji: String = "\uD83C\uDFAF" override val valueLimits: IntRange get() = dartsCubeAndBowlingDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object BasketballDiceAnimationType : DiceAnimationType { override val emoji: String = "\uD83C\uDFC0" override val valueLimits: IntRange get() = basketballAndFootballDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object FootballDiceAnimationType : DiceAnimationType { override val emoji: String = "âš½" override val valueLimits: IntRange get() = basketballAndFootballDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object BowlingDiceAnimationType : DiceAnimationType { override val emoji: String = "\uD83C\uDFB3" override val valueLimits: IntRange get() = dartsCubeAndBowlingDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) object SlotMachineDiceAnimationType : DiceAnimationType { override val emoji: String = "\uD83C\uDFB0" override val valueLimits: IntRange get() = slotMachineDiceResultLimit } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(DiceAnimationTypeSerializer::class) data class CustomDiceAnimationType( override val emoji: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt index fee1adbebe..bc9b89d9d0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AnimationFile.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.Serializable @Serializable data class AnimationFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt index 906259f71a..598c099f48 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/AudioFile.kt @@ -9,6 +9,7 @@ import kotlinx.serialization.Serializable @Serializable data class AudioFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt index e3c8b255fb..0cc6069e02 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/DocumentFile.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.Serializable @Serializable data class DocumentFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt index 4ed3da339c..c2461d2561 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/File.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable @Serializable data class File( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt index 5d37f37fd5..c68ffd71b9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PassportFile.kt @@ -11,6 +11,7 @@ import kotlinx.serialization.Serializable */ @Serializable data class PassportFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt index dd256ce8ea..35cf52fe16 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.* @Serializable data class PathedFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -16,6 +17,7 @@ data class PathedFile( @SerialName(fileSizeField) override val fileSize: Long? = null ): TelegramMediaFile { + @Suppress("TRANSIENT_IS_REDUNDANT") @Transient val fileName: FileName by lazy(LazyThreadSafetyMode.PUBLICATION) { filePath.filenameFromUrl diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt index e6ec6e806c..d98589e5b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PhotoSize.kt @@ -38,6 +38,7 @@ object PhotoSerializer : KSerializer by PhotoFile.serializer() @Serializable data class PhotoSize( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt index f4b5665469..c5368d9421 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PlayableMediaFile.kt @@ -1,7 +1,5 @@ package dev.inmo.tgbotapi.types.files -import dev.inmo.tgbotapi.types.files.TelegramMediaFile - sealed interface PlayableMediaFile : TelegramMediaFile { val duration: Long? } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt index 88f122885c..642d2e02df 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/SizedMediaFile.kt @@ -1,7 +1,5 @@ package dev.inmo.tgbotapi.types.files -import dev.inmo.tgbotapi.types.files.TelegramMediaFile - sealed interface SizedMediaFile : TelegramMediaFile { val width: Int val height: Int diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt index f6720e0b8c..3de3db3e73 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/Sticker.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.files import dev.inmo.tgbotapi.requests.abstracts.FileId @@ -15,6 +17,7 @@ import kotlinx.serialization.json.JsonElement @Serializable @RiskFeature("This class is used for serialization/deserialization of Sticker interface") data class StickerSurrogate( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") val file_id: FileId, val file_unique_id: TgFileUniqueId, val type: StickerType, @@ -246,6 +249,7 @@ sealed interface RegularSticker : Sticker { @Serializable data class RegularSimpleSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -277,6 +281,7 @@ data class RegularSimpleSticker( @Serializable data class RegularAnimatedSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -304,6 +309,7 @@ data class RegularAnimatedSticker( } @Serializable data class RegularVideoSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -347,6 +353,7 @@ sealed interface MaskSticker : Sticker { } @Serializable data class MaskSimpleSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -378,6 +385,7 @@ data class MaskSimpleSticker( } @Serializable data class MaskAnimatedSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -405,6 +413,7 @@ data class MaskAnimatedSticker( } @Serializable data class MaskVideoSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -449,6 +458,7 @@ sealed interface CustomEmojiSticker : Sticker { @Serializable data class CustomEmojiSimpleSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -482,6 +492,7 @@ data class CustomEmojiSimpleSticker( } @Serializable data class CustomEmojiAnimatedSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -511,6 +522,7 @@ data class CustomEmojiAnimatedSticker( } @Serializable data class CustomEmojiVideoSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) @@ -541,6 +553,7 @@ data class CustomEmojiVideoSticker( @Serializable data class UnknownSticker( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt index f9207986c9..ee23892bb4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoFile.kt @@ -12,6 +12,7 @@ import kotlinx.serialization.Serializable @Serializable data class VideoFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt index 97cc230ec3..89e2690c30 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VideoNoteFile.kt @@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable @Serializable data class VideoNoteFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt index 27cda4f3ab..fac4890f0b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/VoiceFile.kt @@ -8,6 +8,7 @@ import kotlinx.serialization.Serializable @Serializable data class VoiceFile( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(fileIdField) override val fileId: FileId, @SerialName(fileUniqueIdField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPrivateResults.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPrivateResults.kt index 062eccbdb1..010bce2a3b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPrivateResults.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPrivateResults.kt @@ -16,6 +16,7 @@ data class GiveawayPrivateResults( val count: Int, @SerialName(unclaimedPrizeCountField) override val unclaimedCount: Int, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(giveawayMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) val message: AccessibleMessage? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt index 0b1bfd9912..b3ae465a7a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/giveaway/GiveawayPublicResults.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.giveaway import dev.inmo.tgbotapi.abstracts.WithPreviewChat @@ -5,7 +7,6 @@ import dev.inmo.tgbotapi.abstracts.WithPreviewChatAndMessageId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewChat import dev.inmo.tgbotapi.types.chat.PreviewUser -import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder @@ -35,6 +36,7 @@ sealed interface GiveawayPublicResults : GiveawayInfo, GiveawayResults, WithPrev @SerialName(winnersCountField) override val count: Int = 0 @SerialName(winnersField) + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") override val winners: List = emptyList() @SerialName(additionalChatCountField) override val additionalChats: Int = 0 @@ -62,6 +64,7 @@ sealed interface GiveawayPublicResults : GiveawayInfo, GiveawayResults, WithPrev override val selectionDate: TelegramDate, @SerialName(winnersCountField) override val count: Int, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(winnersField) override val winners: List, @SerialName(additionalChatCountField) @@ -93,6 +96,7 @@ sealed interface GiveawayPublicResults : GiveawayInfo, GiveawayResults, WithPrev val selectionDate: TelegramDate, @SerialName(winnersCountField) val count: Int, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(winnersField) val winners: List, @SerialName(additionalChatCountField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMedia.kt index 292ffe40b3..53e9504a8f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMedia.kt @@ -12,5 +12,6 @@ sealed interface MediaGroupMemberTelegramMedia : TelegramMedia, TextedOutput { sealed interface AudioMediaGroupMemberTelegramMedia: MediaGroupMemberTelegramMedia sealed interface DocumentMediaGroupMemberTelegramMedia: MediaGroupMemberTelegramMedia +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(MediaGroupMemberTelegramMediaSerializer::class) sealed interface VisualMediaGroupMemberTelegramMedia : MediaGroupMemberTelegramMedia, SpoilerableTelegramMedia, WithCustomizableCaptionTelegramMedia diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMediaSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMediaSerializer.kt index 19c9124d52..7413f60c73 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMediaSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/MediaGroupMemberTelegramMediaSerializer.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.media import dev.inmo.tgbotapi.types.typeField import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.nonstrictJsonFormat +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.* @@ -12,7 +13,7 @@ import kotlinx.serialization.json.* @RiskFeature object MediaGroupMemberTelegramMediaSerializer : KSerializer { - @OptIn(InternalSerializationApi::class) + @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class) override val descriptor: SerialDescriptor = buildSerialDescriptor(MediaGroupMemberTelegramMedia::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: MediaGroupMemberTelegramMedia) { when (value) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramFreeMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramFreeMedia.kt index e44ee39146..99b6dcd9c6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramFreeMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramFreeMedia.kt @@ -4,5 +4,6 @@ import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import dev.inmo.tgbotapi.requests.abstracts.InputFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramMediaSerializer::class) sealed interface TelegramFreeMedia : TelegramMedia diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAnimation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAnimation.kt index 31cd7ab371..35cce18c58 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAnimation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAnimation.kt @@ -48,6 +48,7 @@ fun TelegramMediaAnimation( thumb ) +@ConsistentCopyVisibility @Serializable data class TelegramMediaAnimation internal constructor( override val file: InputFile, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt index d9da215565..bb753a54e0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaAudio.kt @@ -39,6 +39,7 @@ fun TelegramMediaAudio( file, text, parseMode, null, duration, performer, title, thumb ) +@ConsistentCopyVisibility @Serializable data class TelegramMediaAudio internal constructor( override val file: InputFile, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt index 109a6cd687..b7c71ebed9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaDocument.kt @@ -46,6 +46,7 @@ fun TelegramMediaDocument( * @see MultipartFile * @see FileId */ +@ConsistentCopyVisibility @Serializable data class TelegramMediaDocument internal constructor( override val file: InputFile, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaPhoto.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaPhoto.kt index 1ef3055b99..c897a1e80c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaPhoto.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaPhoto.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.media import dev.inmo.tgbotapi.requests.abstracts.InputFile @@ -30,6 +32,7 @@ fun TelegramMediaPhoto( showCaptionAboveMedia: Boolean = false ) = TelegramMediaPhoto(file, entities.makeString(), null, entities.toRawMessageEntities(), spoilered, showCaptionAboveMedia) +@ConsistentCopyVisibility @Serializable data class TelegramMediaPhoto internal constructor( override val file: InputFile, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaSerializer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaSerializer.kt index 47291efd32..9975e8dedc 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaSerializer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaSerializer.kt @@ -1,12 +1,14 @@ package dev.inmo.tgbotapi.types.media import dev.inmo.tgbotapi.utils.RiskFeature +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder +@OptIn(ExperimentalSerializationApi::class) @RiskFeature object TelegramMediaSerializer : KSerializer { @OptIn(InternalSerializationApi::class) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaVideo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaVideo.kt index 5d2b861b7d..bfe969e918 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaVideo.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramMediaVideo.kt @@ -69,6 +69,7 @@ fun TelegramMediaVideo( thumb = thumb ) +@ConsistentCopyVisibility @Serializable data class TelegramMediaVideo internal constructor ( override val file: InputFile, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramPaidMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramPaidMedia.kt index 5fb8de028c..7095057f98 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramPaidMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/media/TelegramPaidMedia.kt @@ -4,8 +4,10 @@ import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import dev.inmo.tgbotapi.requests.abstracts.InputFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramMediaSerializer::class) sealed interface TelegramPaidMedia : TelegramMedia +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramMediaSerializer::class) sealed interface VisualTelegramPaidMedia : TelegramPaidMedia diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/MessageOrigin.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/MessageOrigin.kt index e2ff425a35..2be88a87f8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/MessageOrigin.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/MessageOrigin.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.message import dev.inmo.tgbotapi.types.* @@ -49,6 +51,7 @@ sealed interface MessageOrigin { } } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(MessageOrigin.Companion::class) sealed interface Public : MessageOrigin { val chat: PublicChat @@ -75,6 +78,7 @@ sealed interface MessageOrigin { @Serializable data class Channel( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatField) override val chat: ChannelChat, @SerialName(messageIdField) @@ -95,6 +99,7 @@ sealed interface MessageOrigin { } } + @ConsistentCopyVisibility @Serializable data class Unknown internal constructor( override val type: String, @@ -120,6 +125,7 @@ sealed interface MessageOrigin { val messageId: MessageId? = null, @SerialName(senderUserNameField) val name: String? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(senderUserField) val user: PreviewUser? = null ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ParseMode.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ParseMode.kt index ba94337d51..a3c7e798c0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ParseMode.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ParseMode.kt @@ -1,3 +1,5 @@ +@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + package dev.inmo.tgbotapi.types.message import dev.inmo.tgbotapi.utils.RiskFeature diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index 53d0d8f698..8b21df2386 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -55,7 +55,9 @@ internal data class RawMessage( private val chat: PreviewChat, @SerialName(messageThreadIdField) private val messageThreadId: MessageThreadId? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val from: PreviewUser? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val sender_chat: PreviewPublicChat? = null, private val forward_origin: MessageOrigin? = null, private val is_topic_message: Boolean? = null, @@ -99,7 +101,9 @@ internal data class RawMessage( private val group_chat_created: Boolean = false, private val supergroup_chat_created: Boolean = false, private val channel_chat_created: Boolean = false, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val migrate_to_chat_id: IdChatIdentifier? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val migrate_from_chat_id: IdChatIdentifier? = null, private val pinned_message: RawMessage? = null, private val invoice: Invoice? = null, @@ -160,6 +164,7 @@ internal data class RawMessage( // Business private val business_connection_id: BusinessConnectionId? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val sender_business_bot: PreviewBot? = null, // Giveaways @@ -180,6 +185,7 @@ internal data class RawMessage( private val gift: GiftSentOrReceived.Regular? = null, private val unique_gift: GiftSentOrReceived.Unique? = null, ) { + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() } private val content: MessageContent? by lazy { val adaptedCaptionEntities = caption ?.let { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt index a66869d622..90a580bd51 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessageEntity.kt @@ -88,7 +88,7 @@ fun RawMessageEntity.asTextSource( } } -private inline operator fun > ClosedRange.contains(other: ClosedRange): Boolean { +private operator fun > ClosedRange.contains(other: ClosedRange): Boolean { return start <= other.start && endInclusive >= other.endInclusive } @@ -215,6 +215,7 @@ fun TextSourcesList.toRawMessageEntities(preOffset: Int = 0): List textSource.toRawMessageEntities(i).also { + @Suppress("AssignedValueIsNeverRead") // it is used in line above :) i += it.maxByOrNull { it.length }?.length ?: textSource.source.length } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt index d1d036cca5..f3f65249e5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/Message.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.message.abstracts import dev.inmo.tgbotapi.abstracts.WithMessageId @@ -62,7 +64,7 @@ data class UnknownMessageType( ) : AccessibleMessage internal class TelegramBotAPIMessageDeserializationStrategyClass : DeserializationStrategy { - @OptIn(InternalSerializationApi::class) + @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class) override val descriptor: SerialDescriptor = buildSerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) @Suppress("UNCHECKED_CAST") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/PaidMedia.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/PaidMedia.kt index 00a7d69597..ea3e889dd3 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/PaidMedia.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/PaidMedia.kt @@ -1,3 +1,6 @@ +@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE") +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.message.payments import dev.inmo.tgbotapi.types.* @@ -6,6 +9,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile import dev.inmo.tgbotapi.types.files.VideoFile import dev.inmo.tgbotapi.utils.decodeDataAndJson import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt index 427a2a5d3a..21a414c1ab 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BlockquoteTextSource.kt @@ -18,6 +18,6 @@ data class BlockquoteTextSource @RiskFeature(DirectInvocationOfTextSourceConstru override val html: String by lazy { blockquoteHTML() } } -inline fun blockquoteTextSource(parts: TextSourcesList) = BlockquoteTextSource(parts.makeString(), parts) -inline fun blockquoteTextSource(vararg parts: TextSource) = blockquoteTextSource(parts.toList()) -inline fun blockquoteTextSource(text: String) = blockquoteTextSource(regularTextSource(text)) +fun blockquoteTextSource(parts: TextSourcesList) = BlockquoteTextSource(parts.makeString(), parts) +fun blockquoteTextSource(vararg parts: TextSource) = blockquoteTextSource(parts.toList()) +fun blockquoteTextSource(text: String) = blockquoteTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt index 716d45dcd6..674c1fe5ba 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BoldTextSource.kt @@ -18,6 +18,6 @@ data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { boldHTML() } } -inline fun boldTextSource(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) -inline fun boldTextSource(vararg parts: TextSource) = boldTextSource(parts.toList()) -inline fun boldTextSource(text: String) = boldTextSource(regularTextSource(text)) +fun boldTextSource(parts: TextSourcesList) = BoldTextSource(parts.makeString(), parts) +fun boldTextSource(vararg parts: TextSource) = boldTextSource(parts.toList()) +fun boldTextSource(text: String) = boldTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt index 5277ab8c64..1060502889 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/BotCommandTextSource.kt @@ -33,6 +33,6 @@ data class BotCommandTextSource @RiskFeature(DirectInvocationOfTextSourceConstru /** * @param command Without leading "/" */ -inline fun botCommandTextSource(command: String) = BotCommandTextSource("/$command") +fun botCommandTextSource(command: String) = BotCommandTextSource("/$command") -inline fun botCommandTextSource(botCommand: BotCommand) = botCommandTextSource(botCommand.command) +fun botCommandTextSource(botCommand: BotCommand) = botCommandTextSource(botCommand.command) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt index 9e00c8ed77..c4e455945e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CashTagTextSource.kt @@ -25,6 +25,6 @@ data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { cashTagHTML() } } -inline fun cashTagTextSource(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) -inline fun cashTagTextSource(vararg parts: TextSource) = cashTagTextSource(parts.toList()) -inline fun cashTagTextSource(tag: String) = cashTagTextSource(regularTextSource(tag)) +fun cashTagTextSource(parts: TextSourcesList) = CashTagTextSource(parts.makeString(), parts) +fun cashTagTextSource(vararg parts: TextSource) = cashTagTextSource(parts.toList()) +fun cashTagTextSource(tag: String) = cashTagTextSource(regularTextSource(tag)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt index 04ce61ed69..a2928f19e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CodeTextSource.kt @@ -16,4 +16,4 @@ data class CodeTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { source.codeHTML() } } -inline fun codeTextSource(code: String) = CodeTextSource(code) +fun codeTextSource(code: String) = CodeTextSource(code) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt index 13f739cbbf..5fc2558b37 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/CustomEmojiTextSource.kt @@ -21,9 +21,9 @@ data class CustomEmojiTextSource @RiskFeature(DirectInvocationOfTextSourceConstr } @Suppress("EXPERIMENTAL_API_USAGE") -inline fun customEmojiTextSource(emojiId: CustomEmojiId, parts: TextSourcesList) = CustomEmojiTextSource(parts.makeString(), emojiId, parts) -inline fun customEmojiTextSource(emojiId: CustomEmojiId, vararg parts: TextSource) = customEmojiTextSource(emojiId, parts.toList()) +fun customEmojiTextSource(emojiId: CustomEmojiId, parts: TextSourcesList) = CustomEmojiTextSource(parts.makeString(), emojiId, parts) +fun customEmojiTextSource(emojiId: CustomEmojiId, vararg parts: TextSource) = customEmojiTextSource(emojiId, parts.toList()) /** * Without sharp (#) */ -inline fun customEmojiTextSource(emojiId: CustomEmojiId, text: String) = customEmojiTextSource(emojiId, regularTextSource(text)) +fun customEmojiTextSource(emojiId: CustomEmojiId, text: String) = customEmojiTextSource(emojiId, regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt index b030545713..6715267bf6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/EMailTextSource.kt @@ -18,6 +18,6 @@ data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) override val html: String by lazy { emailHTML(source) } } -inline fun emailTextSource(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) -inline fun emailTextSource(vararg parts: TextSource) = emailTextSource(parts.toList()) -inline fun emailTextSource(emailAddress: String) = emailTextSource(regularTextSource(emailAddress)) +fun emailTextSource(parts: TextSourcesList) = EMailTextSource(parts.makeString(), parts) +fun emailTextSource(vararg parts: TextSource) = emailTextSource(parts.toList()) +fun emailTextSource(emailAddress: String) = emailTextSource(regularTextSource(emailAddress)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt index c4d6c1e677..b0461c8d51 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ExpandableBlockquoteTextSource.kt @@ -18,6 +18,6 @@ data class ExpandableBlockquoteTextSource @RiskFeature(DirectInvocationOfTextSou override val html: String by lazy { expandableBlockquoteHTML() } } -inline fun expandableBlockquoteTextSource(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts) -inline fun expandableBlockquoteTextSource(vararg parts: TextSource) = expandableBlockquoteTextSource(parts.toList()) -inline fun expandableBlockquoteTextSource(text: String) = expandableBlockquoteTextSource(regularTextSource(text)) +fun expandableBlockquoteTextSource(parts: TextSourcesList) = ExpandableBlockquoteTextSource(parts.makeString(), parts) +fun expandableBlockquoteTextSource(vararg parts: TextSource) = expandableBlockquoteTextSource(parts.toList()) +fun expandableBlockquoteTextSource(text: String) = expandableBlockquoteTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt index 1d7e585b53..f884bfbd78 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/HashTagTextSource.kt @@ -33,9 +33,9 @@ data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } @Suppress("EXPERIMENTAL_API_USAGE") -inline fun hashtagTextSource(parts: TextSourcesList) = (regularTextSource("#") + parts).let { HashTagTextSource(it.makeString(), it) } -inline fun hashtagTextSource(vararg parts: TextSource) = hashtagTextSource(parts.toList()) +fun hashtagTextSource(parts: TextSourcesList) = (regularTextSource("#") + parts).let { HashTagTextSource(it.makeString(), it) } +fun hashtagTextSource(vararg parts: TextSource) = hashtagTextSource(parts.toList()) /** * Without sharp (#) */ -inline fun hashtagTextSource(hashtag: String) = hashtagTextSource(regularTextSource(hashtag)) +fun hashtagTextSource(hashtag: String) = hashtagTextSource(regularTextSource(hashtag)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt index 5bcd64c95a..fa8a8314f4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/ItalicTextSource.kt @@ -18,7 +18,7 @@ data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor override val html: String by lazy { italicHTML() } } -inline fun italicTextSource(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) -inline fun italicTextSource(vararg parts: TextSource) = italicTextSource(parts.toList()) -inline fun italicTextSource(text: String) = italicTextSource(regularTextSource(text)) +fun italicTextSource(parts: TextSourcesList) = ItalicTextSource(parts.makeString(), parts) +fun italicTextSource(vararg parts: TextSource) = italicTextSource(parts.toList()) +fun italicTextSource(text: String) = italicTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt index c8d4fb1832..d1a007af7a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/MentionTextSource.kt @@ -24,6 +24,7 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val markdown: String by lazy { source.mentionMarkdown() } override val markdownV2: String by lazy { mentionMarkdownV2() } override val html: String by lazy { mentionHTML() } + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") val username: Username = Username.prepare(source) init { @@ -33,13 +34,13 @@ data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo } } -inline fun mentionTextSource(parts: TextSourcesList) = (regularTextSource("@") + parts).let { MentionTextSource(it.makeString(), it) } -inline fun mentionTextSource(vararg parts: TextSource) = mentionTextSource(parts.toList()) +fun mentionTextSource(parts: TextSourcesList) = (regularTextSource("@") + parts).let { MentionTextSource(it.makeString(), it) } +fun mentionTextSource(vararg parts: TextSource) = mentionTextSource(parts.toList()) /** * Without leading "@" */ -inline fun mentionTextSource(whoToMention: String) = mentionTextSource(regularTextSource(whoToMention)) +fun mentionTextSource(whoToMention: String) = mentionTextSource(regularTextSource(whoToMention)) -inline fun mentionTextSource(whoToMention: Username) = mentionTextSource(whoToMention.full.dropWhile { it == '@' }) +fun mentionTextSource(whoToMention: Username) = mentionTextSource(whoToMention.full.dropWhile { it == '@' }) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt index 9723e82bae..2644ea7c32 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PhoneNumberTextSource.kt @@ -18,7 +18,7 @@ data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { phoneHTML() } } -inline fun phoneTextSource(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) -inline fun phoneTextSource(vararg parts: TextSource) = phoneTextSource(parts.toList()) -inline fun phoneTextSource(number: String) = phoneTextSource(regularTextSource(number)) +fun phoneTextSource(parts: TextSourcesList) = PhoneNumberTextSource(parts.makeString(), parts) +fun phoneTextSource(vararg parts: TextSource) = phoneTextSource(parts.toList()) +fun phoneTextSource(number: String) = phoneTextSource(regularTextSource(number)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt index 1d3575a4ee..4a8b58cd48 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/PreTextSource.kt @@ -17,5 +17,5 @@ data class PreTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.preHTML(language) } } -inline fun preTextSource(code: String, language: String? = null) = PreTextSource(code, language) +fun preTextSource(code: String, language: String? = null) = PreTextSource(code, language) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt index 16080e2df1..e67363f512 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/RegularTextSource.kt @@ -16,6 +16,6 @@ data class RegularTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { source.regularHtml() } } -inline fun regularTextSource(text: String) = RegularTextSource(text) +fun regularTextSource(text: String) = RegularTextSource(text) -inline fun regularTextSourceLn(text: String) = regularTextSource("$text\n") +fun regularTextSourceLn(text: String) = regularTextSource("$text\n") diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt index 2c849024a1..6acc2ec79b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/SpoilerTextSource.kt @@ -18,7 +18,7 @@ data class SpoilerTextSource @RiskFeature(DirectInvocationOfTextSourceConstructo override val html: String by lazy { spoilerHTML() } } -inline fun spoilerTextSource(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts) -inline fun spoilerTextSource(vararg parts: TextSource) = spoilerTextSource(parts.toList()) -inline fun spoilerTextSource(text: String) = spoilerTextSource(regularTextSource(text)) +fun spoilerTextSource(parts: TextSourcesList) = SpoilerTextSource(parts.makeString(), parts) +fun spoilerTextSource(vararg parts: TextSource) = spoilerTextSource(parts.toList()) +fun spoilerTextSource(text: String) = spoilerTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt index a29df58a66..dff1bbeb45 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/StrikethroughTextSource.kt @@ -18,6 +18,6 @@ data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceCons override val markdown: String by lazy { source.strikethroughMarkdown() } } -inline fun strikethroughTextSource(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts) -inline fun strikethroughTextSource(vararg parts: TextSource) = strikethroughTextSource(parts.toList()) -inline fun strikethroughTextSource(text: String) = strikethroughTextSource(regularTextSource(text)) +fun strikethroughTextSource(parts: TextSourcesList) = StrikethroughTextSource(parts.makeString(), parts) +fun strikethroughTextSource(vararg parts: TextSource) = strikethroughTextSource(parts.toList()) +fun strikethroughTextSource(text: String) = strikethroughTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt index 6092dbdd02..ad9205981a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextLinkTextSource.kt @@ -17,4 +17,4 @@ data class TextLinkTextSource @RiskFeature(DirectInvocationOfTextSourceConstruct override val html: String by lazy { source.linkHTML(url) } } -inline fun linkTextSource(text: String, url: String) = TextLinkTextSource(text, url) +fun linkTextSource(text: String, url: String) = TextLinkTextSource(text, url) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt index 314c5181b7..63f0377e82 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextMentionTextSource.kt @@ -22,21 +22,21 @@ data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstr override val html: String by lazy { textMentionHTML(user.id) } } -inline fun mentionTextSource(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) -inline fun User.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) -inline fun mentionTextSource(parts: TextSourcesList, userId: UserId) = mentionTextSource(parts, CommonUser(userId, "")) -inline fun UserId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) -inline fun mentionTextSource(parts: TextSourcesList, id: RawChatId) = mentionTextSource(parts, UserId(id)) -inline fun RawChatId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) -inline fun mentionTextSource(user: User, vararg parts: TextSource) = mentionTextSource( +fun mentionTextSource(parts: TextSourcesList, user: User) = TextMentionTextSource(parts.makeString(), user, parts) +fun User.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +fun mentionTextSource(parts: TextSourcesList, userId: UserId) = mentionTextSource(parts, CommonUser(userId, "")) +fun UserId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +fun mentionTextSource(parts: TextSourcesList, id: RawChatId) = mentionTextSource(parts, UserId(id)) +fun RawChatId.mentionTextSource(parts: TextSourcesList) = mentionTextSource(parts, this) +fun mentionTextSource(user: User, vararg parts: TextSource) = mentionTextSource( textSourcesOrElseTextSource(parts.toList()) { RegularTextSource("${user.lastName} ${user.firstName}") }, user ) -inline fun mentionTextSource(text: String, user: User) = mentionTextSource(user, regularTextSource(text)) -inline fun User.mentionTextSource(text: String) = mentionTextSource(this, regularTextSource(text)) -inline fun mentionTextSource(text: String, userId: UserId) = mentionTextSource(text, CommonUser(userId, "")) -inline fun UserId.mentionTextSource(text: String) = mentionTextSource(text, this) -inline fun mentionTextSource(text: String, id: RawChatId) = mentionTextSource(text, UserId(id)) -inline fun RawChatId.mentionTextSource(text: String) = mentionTextSource(text, this) +fun mentionTextSource(text: String, user: User) = mentionTextSource(user, regularTextSource(text)) +fun User.mentionTextSource(text: String) = mentionTextSource(this, regularTextSource(text)) +fun mentionTextSource(text: String, userId: UserId) = mentionTextSource(text, CommonUser(userId, "")) +fun UserId.mentionTextSource(text: String) = mentionTextSource(text, this) +fun mentionTextSource(text: String, id: RawChatId) = mentionTextSource(text, UserId(id)) +fun RawChatId.mentionTextSource(text: String) = mentionTextSource(text, this) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt index e9d06ba110..6d8d667d69 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSource.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.types.message.textsources import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded @@ -55,6 +57,7 @@ operator fun TextSource.plus(other: List) = other.fold(listOf(this)) newList } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TextSourceSerializer::class) sealed interface MultilevelTextSource : TextSource { val subsources: List @@ -109,7 +112,7 @@ fun List.splitForStoryCaption(): List> { /** * This method will prepare [TextSource]s list for messages with [textLength] */ -inline fun List.splitForText(): List> = splitForMessage(textLength) +fun List.splitForText(): List> = splitForMessage(textLength) fun List.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List> = splitForMessage(limit, numberOfParts) @@ -122,4 +125,4 @@ fun List.separateForCaption(): List> = splitForCapt /** * This method will prepare [TextSource]s list for messages with [textLength] */ -inline fun List.separateForText(): List> = splitForText() +fun List.separateForText(): List> = splitForText() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSourcesOrElse.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSourcesOrElse.kt index d7134403f2..c33e41b817 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSourcesOrElse.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/TextSourcesOrElse.kt @@ -2,14 +2,15 @@ package dev.inmo.tgbotapi.types.message.textsources import dev.inmo.tgbotapi.utils.RiskFeature +@Suppress("unused") @RiskFeature -inline fun textSourcesOrElse( +fun textSourcesOrElse( textSources: TextSourcesList, block: () -> TextSourcesList ): TextSourcesList = textSources.takeIf { it.isNotEmpty() } ?: block() @RiskFeature -inline fun textSourcesOrElseTextSource( +fun textSourcesOrElseTextSource( textSources: TextSourcesList, block: () -> TextSource ): TextSourcesList = textSources.takeIf { it.isNotEmpty() } ?: listOf(block()) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt index 87452a945a..5f0548dd02 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/URLTextSource.kt @@ -16,4 +16,4 @@ data class URLTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) c override val html: String by lazy { source.linkHTML(source) } } -inline fun linkTextSource(url: String) = URLTextSource(url) +fun linkTextSource(url: String) = URLTextSource(url) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt index 6a40e2decd..8236b94345 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/textsources/UnderlineTextSource.kt @@ -18,6 +18,6 @@ data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstruc override val html: String by lazy { underlineHTML() } } -inline fun underlineTextSource(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) -inline fun underlineTextSource(vararg parts: TextSource) = underlineTextSource(parts.toList()) -inline fun underlineTextSource(text: String) = underlineTextSource(regularTextSource(text)) +fun underlineTextSource(parts: TextSourcesList) = UnderlineTextSource(parts.makeString(), parts) +fun underlineTextSource(vararg parts: TextSource) = underlineTextSource(parts.toList()) +fun underlineTextSource(text: String) = underlineTextSource(regularTextSource(text)) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt index 7d4c929e1f..347d67a07b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/PassportElementError.kt @@ -1,4 +1,5 @@ -@file:Suppress("unused", "EXPERIMENTAL_API_USAGE") +@file:Suppress("unused", "EXPERIMENTAL_API_USAGE", "DuplicatedCode") +@file:OptIn(ExperimentalSerializationApi::class) package dev.inmo.tgbotapi.types.passport @@ -55,6 +56,7 @@ object PassportElementErrorSerializer : KSerializer { } } override fun serialize(encoder: Encoder, value: PassportElementError) { + @Suppress("UnusedVariable") val neverMindAboutThisVariable = when (value) { is PassportElementErrorFrontSide -> PassportElementErrorFrontSide.serializer().serialize(encoder, value) is PassportElementErrorReverseSide -> PassportElementErrorReverseSide.serializer().serialize(encoder, value) @@ -102,6 +104,29 @@ data class PassportElementErrorDataField( @Required @EncodeDefault override val source: String = dataField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorDataField + + if (type != other.type) return false + if (fieldName != other.fieldName) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + fieldName.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementWithData.createDataError(field: String, message: String) = PassportElementErrorDataField( type, @@ -124,6 +149,27 @@ data class PassportElementErrorFrontSide( @Required @EncodeDefault override val source: String = frontSideField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorFrontSide + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementWithFrontSide.createFrontSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFrontSide( type, @@ -145,6 +191,27 @@ data class PassportElementErrorReverseSide( @Required @EncodeDefault override val source: String = reverseSideField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorReverseSide + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementWithReverseSide.createReverseSideError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorReverseSide( type, @@ -165,6 +232,27 @@ data class PassportElementErrorSelfie( @Required @EncodeDefault override val source: String = selfieField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorSelfie + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementWithSelfie.createSelfieError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorSelfie( type, @@ -187,6 +275,27 @@ data class PassportElementErrorFile( @Required @EncodeDefault override val source: String = fileField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorFile + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementWithFilesCollection.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorFile( type, @@ -229,6 +338,27 @@ data class PassportElementErrorTranslationFile( @Required @EncodeDefault override val source: String = translationFileField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorTranslationFile + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElementTranslatable.createFileError(message: String, unencryptedFileHash: PassportElementHash) = PassportElementErrorTranslationFile( type, @@ -269,6 +399,27 @@ data class PassportElementErrorUnspecified( @Required @EncodeDefault override val source: String = unspecifiedField + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportElementErrorUnspecified + + if (type != other.type) return false + if (!elementHash.contentEquals(other.elementHash)) return false + if (message != other.message) return false + if (source != other.source) return false + + return true + } + + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + elementHash.contentHashCode() + result = 31 * result + message.hashCode() + result = 31 * result + source.hashCode() + return result + } } fun EncryptedPassportElement.createUnspecifiedError(message: String, elementHash: PassportElementHash) = PassportElementErrorUnspecified( type, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt index 689e899964..3d032de027 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableFilesCollection.kt @@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) sealed class EncryptedPassportElementWithTranslatableFilesCollection : EncryptedPassportElementTranslatable, EncryptedPassportElementWithFilesCollection @@ -19,7 +20,28 @@ data class UtilityBill( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableFilesCollection() +) : EncryptedPassportElementWithTranslatableFilesCollection() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as UtilityBill + + if (files != other.files) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = files.hashCode() + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} + @Serializable data class BankStatement( @SerialName(filesField) @@ -29,7 +51,28 @@ data class BankStatement( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableFilesCollection() +) : EncryptedPassportElementWithTranslatableFilesCollection() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as BankStatement + + if (files != other.files) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = files.hashCode() + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} + @Serializable data class RentalAgreement( @SerialName(filesField) @@ -39,7 +82,28 @@ data class RentalAgreement( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableFilesCollection() +) : EncryptedPassportElementWithTranslatableFilesCollection() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as RentalAgreement + + if (files != other.files) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = files.hashCode() + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} + @Serializable data class PassportRegistration( @SerialName(filesField) @@ -49,7 +113,28 @@ data class PassportRegistration( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableFilesCollection() +) : EncryptedPassportElementWithTranslatableFilesCollection() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as PassportRegistration + + if (files != other.files) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = files.hashCode() + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} + @Serializable data class TemporaryRegistration( @SerialName(filesField) @@ -59,5 +144,25 @@ data class TemporaryRegistration( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableFilesCollection() +) : EncryptedPassportElementWithTranslatableFilesCollection() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as TemporaryRegistration + + if (files != other.files) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = files.hashCode() + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt index 54bccbffd5..629e3d48ab 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/EncryptedPassportElementWithTranslatableIDDocument.kt @@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) sealed class EncryptedPassportElementWithTranslatableIDDocument : EncryptedPassportElementWithData, EncryptedPassportElementWithFrontSide, EncryptedPassportElementWithReverseSide, EncryptedPassportElementWithSelfie, EncryptedPassportElementTranslatable @@ -27,7 +28,33 @@ data class DriverLicense( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElementWithTranslatableIDDocument() +) : EncryptedPassportElementWithTranslatableIDDocument() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as DriverLicense + + if (!data.contentEquals(other.data)) return false + if (frontSide != other.frontSide) return false + if (reverseSide != other.reverseSide) return false + if (selfie != other.selfie) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = data.contentHashCode() + result = 31 * result + (frontSide?.hashCode() ?: 0) + result = 31 * result + (reverseSide?.hashCode() ?: 0) + result = 31 * result + (selfie?.hashCode() ?: 0) + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} @Serializable data class IdentityCard( diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt index 272677f6fb..6dbb5429b2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/Passport.kt @@ -1,3 +1,5 @@ +@file:Suppress("DuplicatedCode") + package dev.inmo.tgbotapi.types.passport.encrypted import dev.inmo.micro_utils.serialization.base64.Base64BytesToFromStringSerializer @@ -8,6 +10,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.* import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) sealed class Passport : EncryptedPassportElementWithData, EncryptedPassportElementWithFrontSide, EncryptedPassportElementWithSelfie, EncryptedPassportElementTranslatable @@ -25,7 +28,32 @@ data class CommonPassport( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : Passport() +) : Passport() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as CommonPassport + + if (!data.contentEquals(other.data)) return false + if (frontSide != other.frontSide) return false + if (selfie != other.selfie) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = data.contentHashCode() + result = 31 * result + (frontSide?.hashCode() ?: 0) + result = 31 * result + (selfie?.hashCode() ?: 0) + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} + @Serializable data class InternalPassport( @SerialName(dataField) @@ -40,4 +68,28 @@ data class InternalPassport( @SerialName(hashField) @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : Passport() +) : Passport() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as InternalPassport + + if (!data.contentEquals(other.data)) return false + if (frontSide != other.frontSide) return false + if (selfie != other.selfie) return false + if (translations != other.translations) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + override fun hashCode(): Int { + var result = data.contentHashCode() + result = 31 * result + (frontSide?.hashCode() ?: 0) + result = 31 * result + (selfie?.hashCode() ?: 0) + result = 31 * result + translations.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement.kt index a900d8955f..a31150dffd 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElement.kt @@ -15,9 +15,30 @@ interface EncryptedPassportElement { val hash: PassportElementHash } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) data class UnknownEncryptedPassportElement( val rawJson: JsonObject, @Serializable(Base64BytesToFromStringSerializer::class) override val hash: PassportElementHash -) : EncryptedPassportElement +) : EncryptedPassportElement { + // Autogenerated with advice of Intellij IDEA + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as UnknownEncryptedPassportElement + + if (rawJson != other.rawJson) return false + if (!hash.contentEquals(other.hash)) return false + + return true + } + + // Autogenerated with advice of Intellij IDEA + override fun hashCode(): Int { + var result = rawJson.hashCode() + result = 31 * result + hash.contentHashCode() + return result + } +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt index a23954991d..3cbcaed05d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementTranslatable.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import dev.inmo.tgbotapi.types.files.PassportFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementTranslatable : EncryptedPassportElement { val translations: List diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithData.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithData.kt index 9332b22b0d..6f042d5f40 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithData.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithData.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.credentials.EncryptedData import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithData : EncryptedPassportElement { val data: EncryptedData diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithEmail.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithEmail.kt index e0ddcca903..ed0fc8b3ca 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithEmail.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithEmail.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithEmail : EncryptedPassportElement { val email: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt index feb70221e7..6394e74266 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFilesCollection.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import dev.inmo.tgbotapi.types.files.PassportFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithFilesCollection : EncryptedPassportElement { val files: List diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt index 05df670ad9..a1973df71a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithFrontSide.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import dev.inmo.tgbotapi.types.files.PassportFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithFrontSide : EncryptedPassportElement { val frontSide: PassportFile? diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithPhoneNumber.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithPhoneNumber.kt index 59e4939925..669fa98829 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithPhoneNumber.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithPhoneNumber.kt @@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types.passport.encrypted.abstracts import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithPhoneNumber : EncryptedPassportElement { val phoneNumber: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt index 55095522cd..afb3501ed7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithReverseSide.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import dev.inmo.tgbotapi.types.files.PassportFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithReverseSide : EncryptedPassportElement { val reverseSide: PassportFile? diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt index 6601a01eac..e7d42efb48 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/passport/encrypted/abstracts/EncryptedPassportElementWithSelfie.kt @@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.types.passport.encrypted.EncryptedElementSerializer import dev.inmo.tgbotapi.types.files.PassportFile import kotlinx.serialization.Serializable +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(EncryptedElementSerializer::class) interface EncryptedPassportElementWithSelfie : EncryptedPassportElement { val selfie: PassportFile? diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/stars/TransactionType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/stars/TransactionType.kt index 443d4dfa91..640e3656b7 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/stars/TransactionType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/payments/stars/TransactionType.kt @@ -1,6 +1,9 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.payments.stars import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.descriptors.PrimitiveKind diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt index 08e11141f2..9557c3b22c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/Poll.kt @@ -1,3 +1,5 @@ +@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + package dev.inmo.tgbotapi.types.polls import korlibs.time.DateTime @@ -104,6 +106,7 @@ private class RawPoll( = closeDate ?.asExactScheduledCloseInfo ?: openPeriod ?.asApproximateScheduledCloseInfo } +@ConsistentCopyVisibility @Serializable data class UnknownPollType internal constructor( @SerialName(idField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt index bb0cf406ae..5f4e2c603f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollAnswer.kt @@ -33,6 +33,7 @@ sealed interface PollAnswer: FromUser { data class Anonymous( @SerialName(pollIdField) override val pollId: PollId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(voterChatField) val voterChat: ChannelChat, @SerialName(optionIdsField) @@ -60,6 +61,7 @@ sealed interface PollAnswer: FromUser { val chosen: List, @SerialName(userField) val user: User = Anonymous.defaultUser, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(voterChatField) val voterChat: ChannelChat? = null ) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt index e3293e3e37..6ca674a90b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/polls/PollOption.kt @@ -43,6 +43,7 @@ sealed class PollOption : TextedInput { } } +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(PollOptionSerializer::class) data class SimplePollOption ( @SerialName(textField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/Reaction.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/Reaction.kt index c1057d8447..a7d4a6b698 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/Reaction.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/Reaction.kt @@ -14,6 +14,7 @@ import kotlinx.serialization.json.JsonDecoder import kotlinx.serialization.json.JsonElement import kotlin.jvm.JvmInline +@Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(Reaction.Companion::class) @ClassCastsIncluded sealed interface Reaction { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/ReactionType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/ReactionType.kt index 51c9984006..70ff64a22f 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/ReactionType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/reactions/ReactionType.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.reactions import dev.inmo.tgbotapi.types.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/ChatShared.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/ChatShared.kt index 354cc8bea9..eca3d92e7b 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/ChatShared.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/ChatShared.kt @@ -9,10 +9,12 @@ import kotlinx.serialization.Serializable data class ChatShared( @SerialName(requestIdField) override val requestId: RequestId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(chatIdField) override val chatId: ChatId, @SerialName(titleField) val title: String? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) val username: Username? = null, @SerialName(photoField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/SharedUser.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/SharedUser.kt index b7b861e3b7..f3cd7ff33e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/SharedUser.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/request/SharedUser.kt @@ -7,12 +7,14 @@ import kotlinx.serialization.Serializable @Serializable data class SharedUser( + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(userIdField) val id: UserId, @SerialName(firstNameField) val firstName: String? = null, @SerialName(lastNameField) val lastName: String? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @SerialName(usernameField) val username: Username? = null, @SerialName(photoField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt index edbe00caf8..9cb19c1485 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stickers/StickerSet.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.stickers import dev.inmo.tgbotapi.types.* diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/InputStoryContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/InputStoryContent.kt index cb79add737..baee5cb64d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/InputStoryContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/InputStoryContent.kt @@ -1,9 +1,12 @@ +@file:OptIn(ExperimentalSerializationApi::class) +@file:Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + package dev.inmo.tgbotapi.types.stories import dev.inmo.tgbotapi.requests.abstracts.MultipartFile import dev.inmo.tgbotapi.types.* -import dev.inmo.tgbotapi.utils.decodeDataAndJson import kotlinx.serialization.EncodeDefault +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/StoryAreaType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/StoryAreaType.kt index 4cda1cc99c..28e8f1a1e6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/StoryAreaType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/stories/StoryAreaType.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalSerializationApi::class) + package dev.inmo.tgbotapi.types.stories import dev.inmo.micro_utils.colors.common.HEXAColor diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt index 1082c0e2bc..6ddaae877c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt @@ -28,12 +28,16 @@ import kotlinx.serialization.json.jsonObject internal data class RawUpdate constructor( @SerialName(updateIdField) val updateId: UpdateId, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val edited_message: CommonMessage<*>? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val message: AccessibleMessage? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val edited_channel_post: CommonMessage<*>? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val channel_post: AccessibleMessage? = null, private val inline_query: RawInlineQuery? = null, @@ -52,8 +56,10 @@ internal data class RawUpdate constructor( private val removed_chat_boost: ChatBoostRemoved? = null, @Serializable(BusinessConnection.Companion::class) private val business_connection: BusinessConnection? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val business_message: BusinessContentMessage<*>? = null, + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val edited_business_message: BusinessContentMessage<*>? = null, private val deleted_business_messages: BusinessMessagesDeleted? = null, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/LaunchWithBotLogger.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/LaunchWithBotLogger.kt new file mode 100644 index 0000000000..4b5125e8f0 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/LaunchWithBotLogger.kt @@ -0,0 +1,38 @@ +package dev.inmo.tgbotapi.utils + +import dev.inmo.kslog.common.KSLog +import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions +import dev.inmo.micro_utils.coroutines.subscribeLoggingDropExceptions +import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions +import dev.inmo.tgbotapi.bot.TelegramBot +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.CoroutineStart +import kotlinx.coroutines.flow.Flow +import kotlin.coroutines.CoroutineContext +import kotlin.coroutines.EmptyCoroutineContext + +context(bot: TelegramBot) +fun CoroutineScope.launchWithBotLogger( + errorMessageBuilder: CoroutineScope.(Throwable) -> Any = { "Something web wrong" }, + context: CoroutineContext = EmptyCoroutineContext, + start: CoroutineStart = CoroutineStart.DEFAULT, + block: suspend CoroutineScope.() -> Unit +) = launchLoggingDropExceptions( + errorMessageBuilder, + bot.Log, + context, + start, + block +) + +context(bot: TelegramBot) +fun Flow.subscribeWithBotLogger( + scope: CoroutineScope, + errorMessageBuilder: T.(Throwable) -> Any = { "Something web wrong" }, + block: suspend (T) -> Unit +) = subscribeLoggingDropExceptions ( + scope, + errorMessageBuilder, + bot.Log, + block +) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Matrix.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Matrix.kt index 7a3a4b56e3..e4f5fc3fe0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Matrix.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/Matrix.kt @@ -1,3 +1,5 @@ +@file:Suppress("KDocUnresolvedReference") + package dev.inmo.tgbotapi.utils import dev.inmo.micro_utils.common.withReplaced @@ -23,7 +25,7 @@ inline fun MatrixBuilder.row(block: RowBuilder.() -> Unit) { * @see dev.inmo.tgbotapi.extensions.utils.types.buttons.InlineKeyboardRowBuilder * @see dev.inmo.tgbotapi.extensions.utils.types.buttons.ReplyKeyboardRowBuilder */ -inline fun MatrixBuilder.row(vararg elements: T) { +fun MatrixBuilder.row(vararg elements: T) { add(elements.toList()) } @@ -49,7 +51,7 @@ inline fun flatMatrix(block: RowBuilder.() -> Unit): Matrix { * @see dev.inmo.tgbotapi.extensions.utils.types.buttons.InlineKeyboardBuilder * @see dev.inmo.tgbotapi.extensions.utils.types.buttons.ReplyKeyboardBuilder */ -inline fun flatMatrix(vararg elements: T): Matrix { +fun flatMatrix(vararg elements: T): Matrix { return MatrixBuilder().apply { row { elements.forEach { +it } } }.matrix diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt index ee45272551..53eac9dff5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/MimeType.kt @@ -6,6 +6,7 @@ import kotlinx.serialization.descriptors.* import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @Serializable(MimeTypeSerializer::class) expect class MimeType { val raw: String diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/TextSourcesList.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/TextSourcesList.kt index c8dac1c7ac..77f527cc02 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/TextSourcesList.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/extensions/TextSourcesList.kt @@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.types.message.* val eachLineRegex = Regex("^[^\n]") -inline fun TextSourcesList.makeString( +fun TextSourcesList.makeString( parseMode: ParseMode? = null ) = when (parseMode) { MarkdownParseMode -> makeMarkdownString() @@ -15,15 +15,15 @@ inline fun TextSourcesList.makeString( } -inline fun TextSourcesList.makeSourceString() = joinToString("") { +fun TextSourcesList.makeSourceString() = joinToString("") { it.source } -inline fun TextSourcesList.makeHtmlString() = joinToString("") { +fun TextSourcesList.makeHtmlString() = joinToString("") { it.html } -inline fun TextSourcesList.makeMarkdownV2String(eachLineSeparator: String? = null) = joinToString("") { +fun TextSourcesList.makeMarkdownV2String(eachLineSeparator: String? = null) = joinToString("") { it.markdownV2 }.let { if (eachLineSeparator == null) { @@ -42,6 +42,6 @@ inline fun TextSourcesList.makeMarkdownV2String(eachLineSeparator: String? = nul } } -inline fun TextSourcesList.makeMarkdownString() = joinToString("") { +fun TextSourcesList.makeMarkdownString() = joinToString("") { it.markdown } diff --git a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt index fd842f95bb..738e508530 100644 --- a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.bot.ktor import dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor diff --git a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt index 3b3451a931..e0f47171e6 100644 --- a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt +++ b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt @@ -10,4 +10,5 @@ import io.ktor.client.* * * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 */ +@Suppress("NOTHING_TO_INLINE") internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = client.config { } diff --git a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt index ce99122dfa..bb70b4fa74 100644 --- a/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt +++ b/tgbotapi.core/src/jsMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt @@ -5,6 +5,7 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.Transient import org.w3c.dom.get +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @Serializable(MimeTypeSerializer::class) actual class MimeType( actual val raw: String diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.actual.jvm.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.actual.jvm.kt index fd842f95bb..738e508530 100644 --- a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.actual.jvm.kt +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/KtorRequestsExecutor.actual.jvm.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.bot.ktor import dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt index 3b3451a931..e0f47171e6 100644 --- a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt @@ -10,4 +10,5 @@ import io.ktor.client.* * * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 */ +@Suppress("NOTHING_TO_INLINE") internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = client.config { } diff --git a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt index 3617b5180f..6b11d95570 100644 --- a/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt +++ b/tgbotapi.core/src/jvmMain/kotlin/dev/inmo/tgbotapi/utils/MimeTypeActual.kt @@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.utils import kotlinx.serialization.Serializable +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @Serializable(MimeTypeSerializer::class) actual class MimeType( actual val raw: String diff --git a/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt index 2f49bfc213..920d1ce4ce 100644 --- a/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.bot.ktor import dev.inmo.tgbotapi.bot.ktor.base.MultipleClientKtorRequestsExecutor diff --git a/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt b/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt index ad3e4e5dce..ef61138b91 100644 --- a/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt +++ b/tgbotapi.core/src/linuxArm64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt @@ -11,9 +11,11 @@ import io.ktor.client.engine.cio.* * * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 */ +@Suppress("NOTHING_TO_INLINE") internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = (client.engineConfig as? CIOEngineConfig) ?.let { lateinit var config: HttpClientConfig client.config { + @Suppress("UNCHECKED_CAST") config = this as HttpClientConfig }.close() HttpClient(CIO) { diff --git a/tgbotapi.core/src/linuxArm64Main/kotlin/utils/ActualMimeType.kt b/tgbotapi.core/src/linuxArm64Main/kotlin/utils/ActualMimeType.kt index 18ea512429..2617a06163 100644 --- a/tgbotapi.core/src/linuxArm64Main/kotlin/utils/ActualMimeType.kt +++ b/tgbotapi.core/src/linuxArm64Main/kotlin/utils/ActualMimeType.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable //actual typealias MimeType = MimeType +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @OptIn(RiskFeature::class) @Serializable(MimeTypeSerializer::class) actual data class MimeType( diff --git a/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt index 2f49bfc213..920d1ce4ce 100644 --- a/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.bot.ktor import dev.inmo.tgbotapi.bot.ktor.base.MultipleClientKtorRequestsExecutor diff --git a/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt b/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt index 8f7104ddc0..ffeaadbf1c 100644 --- a/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt +++ b/tgbotapi.core/src/linuxX64Main/kotlin/bot/ktor/base/ActualPlatformClientCopy.kt @@ -11,9 +11,11 @@ import io.ktor.client.engine.curl.* * * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 */ +@Suppress("NOTHING_TO_INLINE") internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = (client.engineConfig as? CurlClientEngineConfig) ?.let { lateinit var config: HttpClientConfig client.config { + @Suppress("UNCHECKED_CAST") config = this as HttpClientConfig }.close() HttpClient(Curl) { diff --git a/tgbotapi.core/src/linuxX64Main/kotlin/utils/ActualMimeType.kt b/tgbotapi.core/src/linuxX64Main/kotlin/utils/ActualMimeType.kt index 18ea512429..c6d8340eb6 100644 --- a/tgbotapi.core/src/linuxX64Main/kotlin/utils/ActualMimeType.kt +++ b/tgbotapi.core/src/linuxX64Main/kotlin/utils/ActualMimeType.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.utils import kotlinx.serialization.Serializable diff --git a/tgbotapi.core/src/mingwX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt b/tgbotapi.core/src/mingwX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt index fd842f95bb..738e508530 100644 --- a/tgbotapi.core/src/mingwX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt +++ b/tgbotapi.core/src/mingwX64Main/kotlin/bot/ktor/KtorRequestsExecutor.kt @@ -1,3 +1,5 @@ +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") + package dev.inmo.tgbotapi.bot.ktor import dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor diff --git a/tgbotapi.core/src/mingwX64Main/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt b/tgbotapi.core/src/mingwX64Main/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt index 05eb9ece47..3824bcf055 100644 --- a/tgbotapi.core/src/mingwX64Main/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt +++ b/tgbotapi.core/src/mingwX64Main/kotlin/dev/inmo/tgbotapi/bot/ktor/base/ActualPlatformClientCopy.kt @@ -11,4 +11,5 @@ import io.ktor.client.engine.winhttp.* * * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 */ +@Suppress("NOTHING_TO_INLINE") internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = client.config { } diff --git a/tgbotapi.core/src/mingwX64Main/kotlin/utils/ActualMimeType.kt b/tgbotapi.core/src/mingwX64Main/kotlin/utils/ActualMimeType.kt index 4158408546..82ec2a080c 100644 --- a/tgbotapi.core/src/mingwX64Main/kotlin/utils/ActualMimeType.kt +++ b/tgbotapi.core/src/mingwX64Main/kotlin/utils/ActualMimeType.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable //actual typealias MimeType = MimeType +@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") @Serializable(MimeTypeSerializer::class) actual data class MimeType( actual val raw: String diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/FlowsAggregation.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/FlowsAggregation.kt index 2be8bcb42e..0e34172978 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/FlowsAggregation.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/FlowsAggregation.kt @@ -15,7 +15,7 @@ fun aggregateFlows( val sharedFlow = MutableSharedFlow(extraBufferCapacity = internalBufferSize) flows.forEach { it.onEach { - safely { sharedFlow.emit(it) } + runCatching { sharedFlow.emit(it) } }.launchIn(withScope) } return sharedFlow diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FilesDownloading.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FilesDownloading.kt index 34cee8856c..6b1c296f6c 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FilesDownloading.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FilesDownloading.kt @@ -5,11 +5,12 @@ import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper import io.ktor.client.HttpClient import io.ktor.client.request.get import io.ktor.client.statement.readBytes +import io.ktor.client.statement.readRawBytes suspend fun HttpClient.loadFile( telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, filePath: String -) = get("${telegramAPIUrlsKeeper.fileBaseUrl}/$filePath").readBytes() +) = get("${telegramAPIUrlsKeeper.fileBaseUrl}/$filePath").readRawBytes() suspend fun HttpClient.loadFile( telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt index 7b0977345a..d1b7bd8a01 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/LinksFormatting.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.extensions.utils.formatting import dev.inmo.tgbotapi.types.* @@ -25,20 +27,20 @@ inline val Username.usernameLink val IdChatIdentifier.chatLink: String get() = makeChatLink(chatId, threadId) fun ChatId.link(threadId: MessageThreadId?) = makeChatLink(chatId, threadId) -inline fun Username.link(threadId: MessageThreadId?) = makeUsernameLink(withoutAt, threadId) +fun Username.link(threadId: MessageThreadId?) = makeUsernameLink(withoutAt, threadId) inline val Username.deepLinkPrefix get() = makeUsernameDeepLinkPrefix(withoutAt) inline val Username.startattachPrefix get() = makeUsernameStartattachPrefix(withoutAt) -inline fun makeLink(username: Username, threadId: MessageThreadId? = null) = username.link(threadId) -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) = +fun makeLink(username: Username, threadId: MessageThreadId? = null) = username.link(threadId) +fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent() +fun makeInternalTgDeepLink(username: String, startParameter: String) = "${makeInternalTgUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent() +fun makeInternalTgDeepLink(username: Username, startParameter: String) = makeInternalTgDeepLink(username.withoutAt, startParameter) -inline fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data) -inline fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.withoutAt, startParameter) -inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter) -inline fun makeTelegramStartattach(username: Username, data: String? = null) = makeTelegramStartattach(username.withoutAt, data) +fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data) +fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.withoutAt, startParameter) +fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter) +fun makeTelegramStartattach(username: Username, data: String? = null) = makeTelegramStartattach(username.withoutAt, data) private val linkIdRedundantPartRegex = Regex("^-100") private val usernameBeginSymbolRegex = Regex("^@") diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/BusinessMessagesMappers.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/BusinessMessagesMappers.kt index a3ae83dace..7e64179273 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/BusinessMessagesMappers.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/BusinessMessagesMappers.kt @@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.types.message.content.MessageContent import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filterIsInstance -inline fun Flow.businessMessages() = filterIsInstance>() +fun Flow.businessMessages() = filterIsInstance>() inline fun Flow>.businessMessagesWithType() = filterIsInstance>() -inline fun Flow>.allBusinessMessages() = businessMessagesWithType() +fun Flow>.allBusinessMessages() = businessMessagesWithType() diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt index 566db560a6..07dca48790 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt @@ -39,13 +39,10 @@ inline fun Flow.filterContent inline fun FlowsUpdatesFilter.filterContentMessages( scopeToIncludeChannels: CoroutineScope? = null ): Flow> { - return (scopeToIncludeChannels ?.let { scope -> - aggregateFlows( - scope, - messagesFlow, - channelPostsFlow - ) - } ?: messagesFlow).filterContentMessages() + return merge( + messagesFlow, + channelPostsFlow + ).filterContentMessages() } fun FlowsUpdatesFilter.sentMessages( diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/RequestsExecutor.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/RequestsExecutor.kt index f71350ad97..3c049a6e16 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/RequestsExecutor.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/RequestsExecutor.kt @@ -1,5 +1,7 @@ package dev.inmo.tgbotapi.extensions.utils.shortcuts +import dev.inmo.micro_utils.coroutines.replaceIfFailure +import dev.inmo.micro_utils.coroutines.runCatchingLogging import dev.inmo.micro_utils.coroutines.safely import dev.inmo.tgbotapi.bot.RequestsExecutor import dev.inmo.tgbotapi.requests.abstracts.Request @@ -10,9 +12,9 @@ fun RequestsExecutor.executeAsync( request: Request, scope: CoroutineScope ): Deferred = scope.async { - safely { + runCatchingLogging(logger = Log) { execute(request) - } + }.getOrThrow() } suspend fun RequestsExecutor.executeAsync( @@ -28,16 +30,14 @@ suspend fun RequestsExecutor.executeUnsafe( var leftRetries = retries val exceptions = onAllFailed ?.let { mutableListOf() } do { - return safely ( - { - leftRetries-- - delay(retriesDelay) - exceptions ?.add(it) - null - } - ) { + return runCatching { execute(request) - } ?: continue + }.replaceIfFailure { + leftRetries-- + delay(retriesDelay) + exceptions?.add(it) + null + }.getOrThrow() ?: continue } while(leftRetries >= 0) onAllFailed ?.invoke(exceptions ?.toTypedArray() ?: emptyArray()) return null diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/InlineKeyboardBuilder.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/InlineKeyboardBuilder.kt index 152078de6f..dc450dc673 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/InlineKeyboardBuilder.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/InlineKeyboardBuilder.kt @@ -69,7 +69,7 @@ inline fun InlineKeyboardMarkup.modified( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.payButton( +fun InlineKeyboardRowBuilder.payButton( text: String ) = add(PayInlineKeyboardButton(text)) @@ -79,7 +79,7 @@ inline fun InlineKeyboardRowBuilder.payButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.dataButton( +fun InlineKeyboardRowBuilder.dataButton( text: String, data: String ) = add(CallbackDataInlineKeyboardButton(text, data)) @@ -90,7 +90,7 @@ inline fun InlineKeyboardRowBuilder.dataButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.gameButton( +fun InlineKeyboardRowBuilder.gameButton( text: String ) = add(CallbackGameInlineKeyboardButton(text)) @@ -100,7 +100,7 @@ inline fun InlineKeyboardRowBuilder.gameButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.loginButton( +fun InlineKeyboardRowBuilder.loginButton( text: String, loginUrl: LoginURL ) = add(LoginURLInlineKeyboardButton(text, loginUrl)) @@ -111,7 +111,7 @@ inline fun InlineKeyboardRowBuilder.loginButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.copyTextButton( +fun InlineKeyboardRowBuilder.copyTextButton( text: String, data: CopyTextButtonData ) = add(CopyTextButton(text, data)) @@ -122,7 +122,7 @@ inline fun InlineKeyboardRowBuilder.copyTextButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.copyTextButton( +fun InlineKeyboardRowBuilder.copyTextButton( text: String, data: String ) = copyTextButton(text, CopyTextButtonData(data)) @@ -133,7 +133,7 @@ inline fun InlineKeyboardRowBuilder.copyTextButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.inlineQueryInCurrentChatButton( +fun InlineKeyboardRowBuilder.inlineQueryInCurrentChatButton( text: String, data: String ) = add(SwitchInlineQueryCurrentChatInlineKeyboardButton(text, data)) @@ -144,7 +144,7 @@ inline fun InlineKeyboardRowBuilder.inlineQueryInCurrentChatButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( +fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( text: String, parameters: SwitchInlineQueryChosenChat ) = add(SwitchInlineQueryChosenChatInlineKeyboardButton(text, parameters)) @@ -155,7 +155,7 @@ inline fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( +fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( text: String, query: String? = null, allowUsers: Boolean = false, @@ -172,7 +172,7 @@ inline fun InlineKeyboardRowBuilder.inlineQueryInChosenChatButton( allowChannels = allowChannels ) ) -inline fun InlineKeyboardRowBuilder.inlineQueryInAnyChosenChatButton( +fun InlineKeyboardRowBuilder.inlineQueryInAnyChosenChatButton( text: String, query: String? = null, ) = inlineQueryInChosenChatButton(text, query, allowUsers = true, allowBots = true, allowGroups = true, allowChannels = true) @@ -183,7 +183,7 @@ inline fun InlineKeyboardRowBuilder.inlineQueryInAnyChosenChatButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.inlineQueryButton( +fun InlineKeyboardRowBuilder.inlineQueryButton( text: String, data: String ) = add(SwitchInlineQueryInlineKeyboardButton(text, data)) @@ -194,7 +194,7 @@ inline fun InlineKeyboardRowBuilder.inlineQueryButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.urlButton( +fun InlineKeyboardRowBuilder.urlButton( text: String, url: String ) = add(URLInlineKeyboardButton(text, url)) @@ -205,7 +205,7 @@ inline fun InlineKeyboardRowBuilder.urlButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.webAppButton( +fun InlineKeyboardRowBuilder.webAppButton( text: String, webApp: WebAppInfo ) = add(WebAppInlineKeyboardButton(text, webApp)) @@ -216,7 +216,7 @@ inline fun InlineKeyboardRowBuilder.webAppButton( * @see inlineKeyboard * @see InlineKeyboardBuilder.row */ -inline fun InlineKeyboardRowBuilder.webAppButton( +fun InlineKeyboardRowBuilder.webAppButton( text: String, url: String ) = webAppButton(text, WebAppInfo(url)) diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt index 24e9069363..6da80fca92 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused", "RemoveExplicitTypeArguments") + package dev.inmo.tgbotapi.extensions.utils.types.buttons import dev.inmo.tgbotapi.types.buttons.* @@ -75,7 +77,7 @@ inline fun flatReplyKeyboard( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.simpleButton( +fun ReplyKeyboardRowBuilder.simpleButton( text: String ) = add(SimpleKeyboardButton(text)) @@ -85,7 +87,7 @@ inline fun ReplyKeyboardRowBuilder.simpleButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestContactButton( +fun ReplyKeyboardRowBuilder.requestContactButton( text: String ) = add(RequestContactKeyboardButton(text)) @@ -95,7 +97,7 @@ inline fun ReplyKeyboardRowBuilder.requestContactButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestLocationButton( +fun ReplyKeyboardRowBuilder.requestLocationButton( text: String ) = add(RequestLocationKeyboardButton(text)) @@ -105,7 +107,7 @@ inline fun ReplyKeyboardRowBuilder.requestLocationButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestPollButton( +fun ReplyKeyboardRowBuilder.requestPollButton( text: String, pollType: KeyboardButtonPollType ) = add(RequestPollKeyboardButton(text, pollType)) @@ -116,7 +118,7 @@ inline fun ReplyKeyboardRowBuilder.requestPollButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.webAppButton( +fun ReplyKeyboardRowBuilder.webAppButton( text: String, webApp: WebAppInfo ) = add(WebAppKeyboardButton(text, webApp)) @@ -127,7 +129,7 @@ inline fun ReplyKeyboardRowBuilder.webAppButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.webAppButton( +fun ReplyKeyboardRowBuilder.webAppButton( text: String, url: String ) = webAppButton(text, WebAppInfo(url)) @@ -139,7 +141,7 @@ inline fun ReplyKeyboardRowBuilder.webAppButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestUsersButton( +fun ReplyKeyboardRowBuilder.requestUsersButton( text: String, requestUser: KeyboardButtonRequestUsers ) = add( @@ -155,7 +157,7 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestBotsButton( +fun ReplyKeyboardRowBuilder.requestBotsButton( text: String, requestId: RequestId, maxCount: Int = keyboardButtonRequestUserLimit.first, @@ -179,7 +181,7 @@ inline fun ReplyKeyboardRowBuilder.requestBotsButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestBotButton( +fun ReplyKeyboardRowBuilder.requestBotButton( text: String, requestId: RequestId, requestName: Boolean? = null, @@ -200,7 +202,7 @@ inline fun ReplyKeyboardRowBuilder.requestBotButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestUsersButton( +fun ReplyKeyboardRowBuilder.requestUsersButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -226,7 +228,7 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestUserButton( +fun ReplyKeyboardRowBuilder.requestUserButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -249,7 +251,7 @@ inline fun ReplyKeyboardRowBuilder.requestUserButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton( +fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton( text: String, requestId: RequestId, premiumUser: Boolean? = null, @@ -275,7 +277,7 @@ inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestUserOrBotButton( +fun ReplyKeyboardRowBuilder.requestUserOrBotButton( text: String, requestId: RequestId, requestName: Boolean? = null, @@ -297,7 +299,7 @@ inline fun ReplyKeyboardRowBuilder.requestUserOrBotButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestChatButton( +fun ReplyKeyboardRowBuilder.requestChatButton( text: String, requestChat: KeyboardButtonRequestChat ) = add( @@ -313,7 +315,7 @@ inline fun ReplyKeyboardRowBuilder.requestChatButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestChatButton( +fun ReplyKeyboardRowBuilder.requestChatButton( text: String, requestId: RequestId, isChannel: Boolean? = null, @@ -349,7 +351,7 @@ inline fun ReplyKeyboardRowBuilder.requestChatButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestChannelButton( +fun ReplyKeyboardRowBuilder.requestChannelButton( text: String, requestId: RequestId, isPublic: Boolean? = null, @@ -381,7 +383,7 @@ inline fun ReplyKeyboardRowBuilder.requestChannelButton( * @see replyKeyboard * @see ReplyKeyboardBuilder.row */ -inline fun ReplyKeyboardRowBuilder.requestGroupButton( +fun ReplyKeyboardRowBuilder.requestGroupButton( text: String, requestId: RequestId, isForum: Boolean? = null, diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt index d7d2a071b1..1e96de595f 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/LongPolling.kt @@ -15,6 +15,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.updateshandlers.* import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog +import dev.inmo.tgbotapi.utils.subscribeWithBotLogger import io.ktor.client.plugins.HttpRequestTimeoutException import io.ktor.utils.io.CancellationException import kotlinx.coroutines.* @@ -155,15 +156,14 @@ fun TelegramBot.startGettingOfUpdatesByLongPolling( updatesReceiver: UpdateReceiver ): Job = longPollingFlow( timeoutSeconds = timeoutSeconds, - exceptionsHandler = exceptionsHandler, + exceptionsHandler = exceptionsHandler ?: defaultSafelyExceptionHandler, allowedUpdates = allowedUpdates, autoDisableWebhooks = autoDisableWebhooks, autoSkipTimeoutExceptions = autoSkipTimeoutExceptions, mediaGroupsDebounceTimeMillis = mediaGroupsDebounceTimeMillis -).subscribeSafely( - scope, - exceptionsHandler ?: defaultSafelyExceptionHandler, - updatesReceiver +).subscribeWithBotLogger( + scope = scope, + block = updatesReceiver ) /** @@ -219,8 +219,8 @@ fun TelegramBot.retrieveAccumulatedUpdates( allowedUpdates, autoDisableWebhooks, mediaGroupsDebounceTimeMillis -).subscribeSafelyWithoutExceptions( - scope.LinkedSupervisorScope() +).subscribeWithBotLogger( + scope.LinkedSupervisorScope(), ) { updatesReceiver(it) } diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt index 8a5fe97650..3726a296ba 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/MediaGroupsIncluder.kt @@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.extensions.utils.updates.retrieving import dev.inmo.kslog.common.KSLog import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions -import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.utils.updates.convertWithMediaGroupUpdates import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate diff --git a/tgbotapi.utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/Webhook.kt b/tgbotapi.utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/Webhook.kt index aec99e21aa..8fadb96c10 100644 --- a/tgbotapi.utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/Webhook.kt +++ b/tgbotapi.utils/src/jvmMain/kotlin/dev/inmo/tgbotapi/extensions/utils/updates/retrieving/Webhook.kt @@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.updates.retrieving import dev.inmo.kslog.common.KSLog import dev.inmo.micro_utils.coroutines.ExceptionHandler -import dev.inmo.micro_utils.coroutines.runCatchingSafely +import dev.inmo.micro_utils.coroutines.runCatchingLogging import dev.inmo.tgbotapi.bot.RequestsExecutor import dev.inmo.tgbotapi.extensions.utils.nonstrictJsonFormat import dev.inmo.tgbotapi.extensions.utils.updates.flowsUpdatesFilter @@ -48,7 +48,7 @@ fun Route.includeWebhookHandlingInRoute( val transformer = scope.updateHandlerWithMediaGroupsAdaptation(block, mediaGroupsDebounceTimeMillis, logger = logger) post { try { - runCatchingSafely { + runCatchingLogging(logger = logger) { val update = nonstrictJsonFormat.decodeFromString( UpdateDeserializationStrategy, call.receiveText() diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/ThemeParams.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/ThemeParams.kt index 754e6e881a..5731187e99 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/ThemeParams.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/ThemeParams.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.webapps +@Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "unused") external interface ThemeParams { @JsName("bg_color") val backgroundColor: HEXColor? diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt index 8fcd60f4fc..1a942b0649 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebApp.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.webapps import dev.inmo.tgbotapi.types.CustomEmojiId @@ -16,6 +18,7 @@ import dev.inmo.tgbotapi.webapps.storage.DeviceStorage import dev.inmo.tgbotapi.webapps.storage.SecureStorage import dev.inmo.tgbotapi.webapps.stories.StoryShareParams +@Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING") external class WebApp { val version: String @@ -177,7 +180,7 @@ external class WebApp { @JsName("onEvent") internal fun onAccelerometerStopped(type: String, callback: () -> Unit) @JsName("onEvent") - internal fun onPopupClosed(type: String, callback: (dev.inmo.tgbotapi.webapps.popup.PopupClosedEventArg) -> Unit) + internal fun onPopupClosed(type: String, callback: (PopupClosedEventArg) -> Unit) @JsName("onEvent") internal fun onGyroscopeStopped(type: String, callback: () -> Unit) @JsName("onEvent") diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebAppChat.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebAppChat.kt index e0dfa35de9..6eaf6ad8c6 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebAppChat.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/WebAppChat.kt @@ -8,6 +8,7 @@ external interface WebAppChat { val id: ChatIdentifier val type: String val title: String + @Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING") val username: Username? @JsName("photo_url") val photoUrl: String? diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/biometric/BiometricManager.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/biometric/BiometricManager.kt index 41798ec126..3c52f50d05 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/biometric/BiometricManager.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/biometric/BiometricManager.kt @@ -1,7 +1,10 @@ +@file:Suppress("unused") + package dev.inmo.tgbotapi.webapps.biometric import kotlinx.coroutines.CompletableDeferred +@Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING") external interface BiometricManager { val isInited: Boolean val isBiometricAvailable: Boolean diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/cloud/CloudStorage.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/cloud/CloudStorage.kt index 869e5bf999..803c790d70 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/cloud/CloudStorage.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/cloud/CloudStorage.kt @@ -1,6 +1,6 @@ -package dev.inmo.tgbotapi.webapps.cloud +@file:Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING", "unused") -import kotlin.js.Json +package dev.inmo.tgbotapi.webapps.cloud external interface CloudStorage { fun setItem( diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/haptic/HapticFeedback.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/haptic/HapticFeedback.kt index dad3bae8af..f22ad27f6d 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/haptic/HapticFeedback.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/haptic/HapticFeedback.kt @@ -1,5 +1,6 @@ package dev.inmo.tgbotapi.webapps.haptic +@Suppress("unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING") external interface HapticFeedback { fun impactOccurred(style: HapticFeedbackStyle) fun notificationOccurred(type: HapticFeedbackType) diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/popup/PopupButton.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/popup/PopupButton.kt index 992a70c1cb..0557ea2a60 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/popup/PopupButton.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/popup/PopupButton.kt @@ -1,3 +1,5 @@ +@file:Suppress("unused", "INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING") + package dev.inmo.tgbotapi.webapps.popup import kotlin.js.json