diff --git a/CHANGELOG.md b/CHANGELOG.md index 908a9149fe..994908e575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # TelegramBotAPI changelog +## 0.35.6 + +* `Common`: + * `Version`: + * `Klock`: `2.3.1` -> `2.3.3` + * `MicroUtils`: `0.5.19` -> `0.5.21` +* `Core`: + * All `FlowsUpdatesFilter` flows have been renamed and updated +* `Utils`: + * Extensions `allSentMessagesFlow` and `allSentMediaGroupsFlow` have been deprecated + ## 0.35.5 **MIME TYPES FOR REQUESTS HAVE BEEN DEPRECATED DUE TO REDUNDANCY OF MIME TYPES IN FILES SENDING** diff --git a/README.md b/README.md index c8ed2c416f..1a4669ec73 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ # TelegramBotAPI +- [TelegramBotAPI](#telegrambotapi) + * [Examples](#examples) + + [Most common example](#most-common-example) + + [Handling only last messages](#handling-only-last-messages) + + [Build a little bit more complex behaviour](#build-a-little-bit-more-complex-behaviour) + + [More examples](#more-examples) + +Table of contents generated with markdown-toc + Hello! This is a set of libraries for working with Telegram Bot API. | Common info | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://github.com/InsanusMokrassar/TelegramBotAPI/workflows/Build/badge.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [Small survey](https://forms.gle/2Hex2ynbHWHhi1KY7)| diff --git a/TelegramBotAPI.drawio b/TelegramBotAPI.drawio new file mode 100644 index 0000000000..0bc0fa2013 --- /dev/null +++ b/TelegramBotAPI.drawio @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/TelegramBotAPI.minder b/TelegramBotAPI.minder deleted file mode 100644 index 8128899caf..0000000000 --- a/TelegramBotAPI.minder +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/gradle.properties b/docs/gradle.properties index 681b8537a1..ffe27b79a8 100644 --- a/docs/gradle.properties +++ b/docs/gradle.properties @@ -1,3 +1,3 @@ -dokka_version=1.4.32 +dokka_version=1.5.0 org.gradle.jvmargs=-Xmx1024m diff --git a/gradle.properties b/gradle.properties index 671a2cfeae..0443c5177f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,15 +8,15 @@ kotlin.incremental.js=true kotlin_version=1.5.21 kotlin_coroutines_version=1.5.1 kotlin_serialisation_runtime_version=1.2.2 -klock_version=2.3.1 +klock_version=2.3.3 uuid_version=0.3.0 ktor_version=1.6.2 -micro_utils_version=0.5.19 +micro_utils_version=0.5.21 javax_activation_version=1.1.1 library_group=dev.inmo -library_version=0.35.5 +library_version=0.35.6 github_release_plugin_version=2.2.12 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5416585156..8ad73a75c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip diff --git a/resources/TelegramBotAPI-libraries-hierarchy.svg b/resources/TelegramBotAPI-libraries-hierarchy.svg index 356ebc5a62..774ed45810 100644 --- a/resources/TelegramBotAPI-libraries-hierarchy.svg +++ b/resources/TelegramBotAPI-libraries-hierarchy.svg @@ -1,965 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +tgbotapi.extensions.apiExtensions project for make requests more look like in the Telegram Bot API and give opportunity to use it's easiertgbotapi.extensions.api...tgbotapi.coreRoot project with API. It is not recommended to use its requests directly and better to use at least tgbotapi.extensions.apitgbotapi.core...tgbotapi.extensions.utilsExtensions project with utils things which will make easier different operationstgbotapi.extensions.utils...tgbotapi.extensions.behaviour_builderExtension project for building bot behaviour via special DSLtgbotapi.extensions.behaviour_builder...tgbotapiHere included all available TelegramBotAPI libraries:tgbotapi.coretgbotapi.extensions.apitgbotapi.extensions.utilstgbotapi.extensions.behaviour_buildertgbotapi...Viewer does not support full SVG 1.1 diff --git a/tgbotapi.core/README.md b/tgbotapi.core/README.md index f4eeda039d..4f888a0d23 100644 --- a/tgbotapi.core/README.md +++ b/tgbotapi.core/README.md @@ -2,6 +2,20 @@ [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core) +- [TelegramBotAPI Core](#telegrambotapi-core) + * [What is it?](#what-is-it-) + * [Compatibility](#compatibility) + * [How to implement library?](#how-to-implement-library-) + + [Maven](#maven) + + [Gradle](#gradle) + * [How to work with library?](#how-to-work-with-library-) + + [Types](#types) + + [Requests](#requests) + + [RequestsExecutor](#requestsexecutor) + + [Passport](#passport) + +Table of contents generated with markdown-toc + ## What is it? Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter.kt index de735db1c4..a926a0c719 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter.kt @@ -14,24 +14,79 @@ interface FlowsUpdatesFilter : UpdatesFilter { val allUpdatesFlow: Flow val allUpdatesWithoutMediaGroupsGroupingFlow: Flow + val messagesFlow: Flow + val messageMediaGroupsFlow: Flow + val editedMessagesFlow: Flow + val editedMessageMediaGroupsFlow: Flow + val channelPostsFlow: Flow + val channelPostMediaGroupsFlow: Flow + val editedChannelPostsFlow: Flow + val editedChannelPostMediaGroupsFlow: Flow + val chosenInlineResultsFlow: Flow + val inlineQueriesFlow: Flow + val callbackQueriesFlow: Flow + val shippingQueriesFlow: Flow + val preCheckoutQueriesFlow: Flow + val pollsFlow: Flow + val pollAnswersFlow: Flow + val chatMemberUpdatesFlow: Flow + val myChatMemberUpdatesFlow: Flow + val unknownUpdatesFlow: Flow + + @Deprecated("Renamed", ReplaceWith("messagesFlow")) val messageFlow: Flow + get() = messagesFlow + @Deprecated("Renamed", ReplaceWith("messageMediaGroupsFlow")) val messageMediaGroupFlow: Flow + get() = messageMediaGroupsFlow + @Deprecated("Renamed", ReplaceWith("editedMessagesFlow")) val editedMessageFlow: Flow + get() = editedMessagesFlow + @Deprecated("Renamed", ReplaceWith("editedMessageMediaGroupsFlow")) val editedMessageMediaGroupFlow: Flow + get() = editedMessageMediaGroupsFlow + @Deprecated("Renamed", ReplaceWith("channelPostsFlow")) val channelPostFlow: Flow + get() = channelPostsFlow + @Deprecated("Renamed", ReplaceWith("channelPostMediaGroupsFlow")) val channelPostMediaGroupFlow: Flow + get() = channelPostMediaGroupsFlow + @Deprecated("Renamed", ReplaceWith("editedChannelPostsFlow")) val editedChannelPostFlow: Flow + get() = editedChannelPostsFlow + @Deprecated("Renamed", ReplaceWith("editedChannelPostMediaGroupsFlow")) val editedChannelPostMediaGroupFlow: Flow + get() = editedChannelPostMediaGroupsFlow + @Deprecated("Renamed", ReplaceWith("chosenInlineResultsFlow")) val chosenInlineResultFlow: Flow + get() = chosenInlineResultsFlow + @Deprecated("Renamed", ReplaceWith("inlineQueriesFlow")) val inlineQueryFlow: Flow + get() = inlineQueriesFlow + @Deprecated("Renamed", ReplaceWith("callbackQueriesFlow")) val callbackQueryFlow: Flow + get() = callbackQueriesFlow + @Deprecated("Renamed", ReplaceWith("shippingQueriesFlow")) val shippingQueryFlow: Flow + get() = shippingQueriesFlow + @Deprecated("Renamed", ReplaceWith("preCheckoutQueriesFlow")) val preCheckoutQueryFlow: Flow + get() = preCheckoutQueriesFlow + @Deprecated("Renamed", ReplaceWith("pollsFlow")) val pollFlow: Flow + get() = pollsFlow + @Deprecated("Renamed", ReplaceWith("pollAnswersFlow")) val pollAnswerFlow: Flow + get() = pollAnswersFlow + @Deprecated("Renamed", ReplaceWith("chatMemberUpdatesFlow")) val chatMemberUpdatedFlow: Flow + get() = chatMemberUpdatesFlow + @Deprecated("Renamed", ReplaceWith("myChatMemberUpdatesFlow")) val myChatMemberUpdatedFlow: Flow + get() = myChatMemberUpdatesFlow + @Deprecated("Renamed", ReplaceWith("unknownUpdatesFlow")) val unknownUpdateTypeFlow: Flow + get() = unknownUpdatesFlow } /** @@ -63,22 +118,22 @@ class DefaultFlowsUpdatesFilter( updatesSharedFlow.emit(it) } - override val messageFlow: Flow = allUpdatesFlow.filterIsInstance() - override val messageMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() - override val editedMessageFlow: Flow = allUpdatesFlow.filterIsInstance() - override val editedMessageMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() - override val channelPostFlow: Flow = allUpdatesFlow.filterIsInstance() - override val channelPostMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() - override val editedChannelPostFlow: Flow = allUpdatesFlow.filterIsInstance() - override val editedChannelPostMediaGroupFlow: Flow = allUpdatesFlow.filterIsInstance() - override val chosenInlineResultFlow: Flow = allUpdatesFlow.filterIsInstance() - override val inlineQueryFlow: Flow = allUpdatesFlow.filterIsInstance() - override val callbackQueryFlow: Flow = allUpdatesFlow.filterIsInstance() - override val shippingQueryFlow: Flow = allUpdatesFlow.filterIsInstance() - override val preCheckoutQueryFlow: Flow = allUpdatesFlow.filterIsInstance() - override val pollFlow: Flow = allUpdatesFlow.filterIsInstance() - override val pollAnswerFlow: Flow = allUpdatesFlow.filterIsInstance() - override val chatMemberUpdatedFlow: Flow = allUpdatesFlow.filterIsInstance() - override val myChatMemberUpdatedFlow: Flow = allUpdatesFlow.filterIsInstance() - override val unknownUpdateTypeFlow: Flow = allUpdatesFlow.filterIsInstance() + override val messagesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val messageMediaGroupsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val editedMessagesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val editedMessageMediaGroupsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val channelPostsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val channelPostMediaGroupsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val editedChannelPostsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val editedChannelPostMediaGroupsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val chosenInlineResultsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val inlineQueriesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val callbackQueriesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val shippingQueriesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val preCheckoutQueriesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val pollsFlow: Flow = allUpdatesFlow.filterIsInstance() + override val pollAnswersFlow: Flow = allUpdatesFlow.filterIsInstance() + override val chatMemberUpdatesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val myChatMemberUpdatesFlow: Flow = allUpdatesFlow.filterIsInstance() + override val unknownUpdatesFlow: Flow = allUpdatesFlow.filterIsInstance() } diff --git a/tgbotapi.extensions.api/README.md b/tgbotapi.extensions.api/README.md index 63b706e7b7..bbe8b0bc77 100644 --- a/tgbotapi.extensions.api/README.md +++ b/tgbotapi.extensions.api/README.md @@ -1,8 +1,19 @@ # TelegramBotAPI extensions -[![Download](https://api.bintray.com/packages/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.api/images/download.svg) ](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.api/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api) +- [TelegramBotAPI extensions](#telegrambotapi-extensions) + * [What is it?](#what-is-it) + * [Compatibility](#compatibility) + * [How to implement library?](#how-to-implement-library) + + [Maven](#maven) + + [Gradle](#gradle) + * [Example of usage and comparison with `TelegramBotAPI`](#example-of-usage-and-comparison-with-telegrambotapi) + * [Updates](#updates) + + [Alternative way](#alternative-way) + +Table of contents generated with markdown-toc + ## What is it? It is wrapper library for [TelegramBotAPI Core](../tgbotapi.core/README.md). Here you can find extensions for diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt index 683fa940b2..659f38da0a 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt @@ -21,6 +21,10 @@ import kotlinx.coroutines.launch import kotlin.math.ceil val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L + +/** + * @see startLiveLocation + */ class LiveLocationProvider internal constructor( private val requestsExecutor: TelegramBot, scope: CoroutineScope, diff --git a/tgbotapi.extensions.behaviour_builder/README.md b/tgbotapi.extensions.behaviour_builder/README.md index c618a07ce8..d4160d7c6b 100644 --- a/tgbotapi.extensions.behaviour_builder/README.md +++ b/tgbotapi.extensions.behaviour_builder/README.md @@ -1,5 +1,16 @@ # TelegramBotAPI Behaviour Builder Extensions +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.behaviour_builder/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.behaviour_builder) + +- [TelegramBotAPI Behaviour Builder Extensions](#telegrambotapi-behaviour-builder-extensions) + * [What is it?](#what-is-it) + * [Triggers](#triggers) + * [Waiters](#waiters) + +Table of contents generated with markdown-toc + +## What is it? + This extension was created to make it more simple to build bot steps handling. Usually, you must use something like: ```kotlin diff --git a/tgbotapi.extensions.utils/README.md b/tgbotapi.extensions.utils/README.md index aa10cd0b86..3fef81edfe 100644 --- a/tgbotapi.extensions.utils/README.md +++ b/tgbotapi.extensions.utils/README.md @@ -1,5 +1,6 @@ # TelegramBotAPI Util Extensions +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils) - [TelegramBotAPI Util Extensions](#telegrambotapi-util-extensions) * [What is it?](#what-is-it) @@ -9,7 +10,7 @@ * [How to use?](#how-to-use) + [Updates](#updates) - [Long polling](#long-polling) - - [WebHooks (currently JVM-only)](#webhooks--currently-jvm-only) + - [WebHooks (currently JVM-only)](#webhooks-currently-jvm-only) + [Filters](#filters) - [Sent messages](#sent-messages) * [Common messages](#common-messages) @@ -19,9 +20,6 @@ Table of contents generated with markdown-toc -[![Download](https://api.bintray.com/packages/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.utils/images/download.svg) ](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.utils/_latestVersion) -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils) - ## What is it? It is wrapper library for [TelegramBotAPI Core](../tgbotapi.core/README.md). Currently, this library contains some usefull filters for commands, updates types and different others. diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FlowsUpdatesFilter.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FlowsUpdatesFilter.kt index b300a1dace..168c4ca798 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FlowsUpdatesFilter.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/FlowsUpdatesFilter.kt @@ -6,14 +6,16 @@ import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.merge +@Deprecated("Will be removed soon", ReplaceWith("messagesFlow + channelPostsFlow")) val FlowsUpdatesFilter.allSentMessagesFlow: Flow get() = merge( - messageFlow, - channelPostFlow + messagesFlow, + channelPostsFlow ) +@Deprecated("Will be removed soon", ReplaceWith("messageMediaGroupsFlow + channelPostMediaGroupsFlow")) val FlowsUpdatesFilter.allSentMediaGroupsFlow: Flow get() = merge( - messageMediaGroupFlow, - channelPostMediaGroupFlow + messageMediaGroupsFlow, + channelPostMediaGroupsFlow ) diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/EventsShortcuts.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/EventsShortcuts.kt index 54df4bdd03..e51288d803 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/EventsShortcuts.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/EventsShortcuts.kt @@ -14,21 +14,21 @@ import kotlinx.coroutines.flow.mapNotNull @RiskFeature("Use with caution") inline fun FlowsUpdatesFilter.events(): Flow> { - return channelPostFlow.mapNotNull { it.data as? ChatEventMessage<*> } + messageFlow.mapNotNull { it.data as? ChatEventMessage<*> } + return channelPostsFlow.mapNotNull { it.data as? ChatEventMessage<*> } + messagesFlow.mapNotNull { it.data as? ChatEventMessage<*> } } @RiskFeature("Use with caution") -inline fun FlowsUpdatesFilter.channelEvents(): Flow> = channelPostFlow.mapNotNull { +inline fun FlowsUpdatesFilter.channelEvents(): Flow> = channelPostsFlow.mapNotNull { it.data as? ChannelEventMessage<*> } @RiskFeature("Use with caution") -inline fun FlowsUpdatesFilter.groupEvents(): Flow> = messageFlow.mapNotNull { +inline fun FlowsUpdatesFilter.groupEvents(): Flow> = messagesFlow.mapNotNull { it.data as? GroupEventMessage<*> } @RiskFeature("Use with caution") -inline fun FlowsUpdatesFilter.supergroupEvents(): Flow> = messageFlow.mapNotNull { +inline fun FlowsUpdatesFilter.supergroupEvents(): Flow> = messagesFlow.mapNotNull { it.data as? SupergroupEventMessage<*> } diff --git a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt index 05b2fc0233..8964dd1ad3 100644 --- a/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt +++ b/tgbotapi.extensions.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/shortcuts/FlowsUpdatesFilter.kt @@ -47,8 +47,8 @@ inline fun Flow.filterMedi /** * @param scopeToIncludeChannels This parameter is required when you want to include [textMessages] for channels too. - * In this case will be created new channel which will aggregate messages from [FlowsUpdatesFilter.messageFlow] and - * [FlowsUpdatesFilter.channelPostFlow]. In case it is null will be used [Flow]s mapping + * In this case will be created new channel which will aggregate messages from [FlowsUpdatesFilter.messagesFlow] and + * [FlowsUpdatesFilter.channelPostsFlow]. In case it is null will be used [Flow]s mapping */ @Suppress("UNCHECKED_CAST") @RiskFeature(lowLevelRiskFeatureMessage) @@ -58,16 +58,16 @@ inline fun FlowsUpdatesFilter.filterContentMessages( return (scopeToIncludeChannels ?.let { scope -> aggregateFlows( scope, - messageFlow, - channelPostFlow + messagesFlow, + channelPostsFlow ) - } ?: messageFlow).filterContentMessages() + } ?: messagesFlow).filterContentMessages() } /** * @param scopeToIncludeChannels This parameter is required when you want to include [SentMediaGroupUpdate] for channels - * too. In this case will be created new channel which will aggregate messages from [FlowsUpdatesFilter.messageFlow] and - * [FlowsUpdatesFilter.channelPostFlow]. In case it is null will be used [Flow]s mapping + * too. In this case will be created new channel which will aggregate messages from [FlowsUpdatesFilter.messagesFlow] and + * [FlowsUpdatesFilter.channelPostsFlow]. In case it is null will be used [Flow]s mapping */ @Suppress("UNCHECKED_CAST") @RiskFeature(lowLevelRiskFeatureMessage) @@ -77,10 +77,10 @@ inline fun FlowsUpdatesFilter.filterMediaGroupMes return (scopeToIncludeChannels ?.let { scope -> aggregateFlows( scope, - messageMediaGroupFlow, - channelPostMediaGroupFlow + messageMediaGroupsFlow, + channelPostMediaGroupsFlow ) - } ?: messageMediaGroupFlow).filterMediaGroupMessages() + } ?: messageMediaGroupsFlow).filterMediaGroupMessages() } fun FlowsUpdatesFilter.sentMessages(
Extensions project for make requests more look like in the Telegram Bot API and give opportunity to use it's easier
Root project with API. It is not recommended to use its requests directly and better to use at least tgbotapi.extensions.api
Extensions project with utils things which will make easier different operations
Extension project for building bot behaviour via special DSL
Here included all available TelegramBotAPI libraries: