From 25dcd9bc5231b7309871c89177d3a9660a4691ac Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 10 May 2019 11:26:58 +0800 Subject: [PATCH] Replace "UpdatesFilter" and "UpdatesPoller" into another package --- CHANGELOG.md | 2 + .../updateshandlers/UpdatesFilter.kt | 106 +++++++++++++++++ .../updateshandlers/UpdatesPoller.kt | 98 ++++++++++++++++ .../utils/extensions/UpdatesFilter.kt | 111 ++++-------------- .../utils/extensions/UpdatesPoller.kt | 102 ++-------------- .../utils/extensions/UpdatesPolling.kt | 2 + .../utils/extensions/Webhooks.kt | 2 +- 7 files changed, 244 insertions(+), 179 deletions(-) create mode 100644 src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt create mode 100644 src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesPoller.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 828157d7c4..8ae4d701f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ some default library ### 0.14.1 +* Replace `UpdatesFilter` and `UpdatesPoller` into another package + ## 0.13.0 Telegram Polls * Type `PollOption` and `AnonymousPollOption` added diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt new file mode 100644 index 0000000000..ec04cf59ee --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt @@ -0,0 +1,106 @@ +package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers + +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.types.update.* +import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* +import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver +import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdatesFilter + +data class UpdatesFilter( + private val messageCallback: UpdateReceiver? = null, + private val messageMediaGroupCallback: UpdateReceiver? = null, + private val editedMessageCallback: UpdateReceiver? = null, + private val editedMessageMediaGroupCallback: UpdateReceiver? = null, + private val channelPostCallback: UpdateReceiver? = null, + private val channelPostMediaGroupCallback: UpdateReceiver? = null, + private val editedChannelPostCallback: UpdateReceiver? = null, + private val editedChannelPostMediaGroupCallback: UpdateReceiver? = null, + private val chosenInlineResultCallback: UpdateReceiver? = null, + private val inlineQueryCallback: UpdateReceiver? = null, + private val callbackQueryCallback: UpdateReceiver? = null, + private val shippingQueryCallback: UpdateReceiver? = null, + private val preCheckoutQueryCallback: UpdateReceiver? = null +) { + val asUpdateReceiver: UpdateReceiver = this::invoke + val allowedUpdates = listOfNotNull( + (messageCallback ?: messageMediaGroupCallback) ?.let { UPDATE_MESSAGE }, + (editedMessageCallback ?: editedMessageMediaGroupCallback) ?.let { UPDATE_EDITED_MESSAGE }, + (channelPostCallback ?: channelPostMediaGroupCallback) ?.let { UPDATE_CHANNEL_POST }, + (editedChannelPostCallback ?: editedChannelPostMediaGroupCallback) ?.let { UPDATE_EDITED_CHANNEL_POST }, + chosenInlineResultCallback ?.let { UPDATE_CHOSEN_INLINE_RESULT }, + inlineQueryCallback ?.let { UPDATE_INLINE_QUERY }, + callbackQueryCallback ?.let { UPDATE_CALLBACK_QUERY }, + shippingQueryCallback ?.let { UPDATE_SHIPPING_QUERY }, + preCheckoutQueryCallback ?.let { UPDATE_PRE_CHECKOUT_QUERY } + ) + + suspend fun invoke(update: Update) { + when (update) { + is MessageUpdate -> messageCallback ?.invoke(update) + is MessageMediaGroupUpdate -> messageMediaGroupCallback ?.also { receiver -> + receiver(update) + } ?: messageCallback ?.also { receiver -> + update.origins.mapNotNull { it as? MessageUpdate }.forEach { + receiver(it) + } + } + is EditMessageUpdate -> editedMessageCallback ?.invoke(update) + is EditMessageMediaGroupUpdate -> editedMessageMediaGroupCallback ?.also { receiver -> + receiver(update) + } ?: editedMessageCallback ?.also { receiver -> + update.origins.mapNotNull { it as? EditMessageUpdate }.forEach { + receiver(it) + } + } + is ChannelPostUpdate -> channelPostCallback ?.invoke(update) + is ChannelPostMediaGroupUpdate -> channelPostMediaGroupCallback ?.also { receiver -> + receiver(update) + } ?: channelPostCallback ?.also { receiver -> + update.origins.mapNotNull { it as? ChannelPostUpdate }.forEach { + receiver(it) + } + } + is EditChannelPostUpdate -> editedChannelPostCallback ?.invoke(update) + is EditChannelPostMediaGroupUpdate -> editedChannelPostMediaGroupCallback ?.also { receiver -> + receiver(update) + } ?: editedChannelPostCallback ?.also { receiver -> + update.origins.mapNotNull { it as? EditChannelPostUpdate }.forEach { + receiver(it) + } + } + is ChosenInlineResultUpdate -> chosenInlineResultCallback ?.invoke(update) + is InlineQueryUpdate -> inlineQueryCallback ?.invoke(update) + is CallbackQueryUpdate -> callbackQueryCallback ?.invoke(update) + is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update) + is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update) + } + } +} + +fun createSimpleUpdateFilter( + messageCallback: UpdateReceiver? = null, + mediaGroupCallback: UpdateReceiver? = null, + editedMessageCallback: UpdateReceiver? = null, + channelPostCallback: UpdateReceiver? = null, + editedChannelPostCallback: UpdateReceiver? = null, + chosenInlineResultCallback: UpdateReceiver? = null, + inlineQueryCallback: UpdateReceiver? = null, + callbackQueryCallback: UpdateReceiver? = null, + shippingQueryCallback: UpdateReceiver? = null, + preCheckoutQueryCallback: UpdateReceiver? = null +): UpdatesFilter = UpdatesFilter( + messageCallback = messageCallback, + messageMediaGroupCallback = mediaGroupCallback, + editedMessageCallback = editedMessageCallback, + editedMessageMediaGroupCallback = mediaGroupCallback, + channelPostCallback = channelPostCallback, + channelPostMediaGroupCallback = mediaGroupCallback, + editedChannelPostCallback = editedChannelPostCallback, + editedChannelPostMediaGroupCallback = mediaGroupCallback, + chosenInlineResultCallback = chosenInlineResultCallback, + inlineQueryCallback = inlineQueryCallback, + callbackQueryCallback = callbackQueryCallback, + shippingQueryCallback = shippingQueryCallback, + preCheckoutQueryCallback = preCheckoutQueryCallback +) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesPoller.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesPoller.kt new file mode 100644 index 0000000000..672208d2ea --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesPoller.kt @@ -0,0 +1,98 @@ +package com.github.insanusmokrassar.TelegramBotAPI.updateshandlers + +import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor +import com.github.insanusmokrassar.TelegramBotAPI.requests.GetUpdates +import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.DeleteWebhook +import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier +import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage +import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate +import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdateReceiver +import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.executeUnsafe +import com.github.insanusmokrassar.TelegramBotAPI.utils.mediaGroupId +import com.github.insanusmokrassar.TelegramBotAPI.utils.toMediaGroupUpdate +import kotlinx.coroutines.* +import java.util.concurrent.Executors + +class UpdatesPoller( + private val executor: RequestsExecutor, + private val requestsDelayMillis: Long = 1000, + private val scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()), + private val allowedUpdates: List? = null, + private val block: UpdateReceiver +) { + private var lastHandledUpdate: UpdateIdentifier = 0L + private val mediaGroup: MutableList = mutableListOf() + + private var pollerJob: Job? = null + + private suspend fun sendToBlock(data: Update) { + block(data) + lastHandledUpdate = data.updateId + } + + private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) { + val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId + if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) { + mediaGroup.sortBy { it.updateId } + mediaGroup.toMediaGroupUpdate() ?.let { + sendToBlock(it) + } ?: mediaGroup.forEach { + sendToBlock(it) + } + mediaGroup.clear() + } + inputMediaGroupId ?.let { + mediaGroup.add(update) + } ?: sendToBlock(update ?: return) + } + + private suspend fun getUpdates(): List { + return executor.execute( + GetUpdates( + lastHandledUpdate + 1, // incremented because offset counted from 1 when updates id from 0 + allowed_updates = allowedUpdates + ) + ).map { + it.asUpdate + } + } + + private suspend fun handleUpdates(updates: List) { + for (update in updates) { + (update as? BaseMessageUpdate) ?.let { + if (it.data is MediaGroupMessage) { + pushMediaGroupUpdate(it) + } else { + null + } + } ?:let { + pushMediaGroupUpdate() + sendToBlock(update) + } + } + + pushMediaGroupUpdate() + } + + suspend fun start(): Job { + executor.executeUnsafe(DeleteWebhook()) + return pollerJob ?: scope.launch { + while (isActive) { + delay(requestsDelayMillis) + try { + val updates = getUpdates() + handleUpdates(updates) + } catch (e: Exception) { + e.printStackTrace() + } + } + }.also { + pollerJob = it + } + } + + suspend fun stop() { + pollerJob ?.cancelAndJoin() + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesFilter.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesFilter.kt index 4fcbdf807e..d8ca32c75d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesFilter.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesFilter.kt @@ -1,81 +1,25 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions -import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter -data class UpdatesFilter( - private val messageCallback: UpdateReceiver? = null, - private val messageMediaGroupCallback: UpdateReceiver? = null, - private val editedMessageCallback: UpdateReceiver? = null, - private val editedMessageMediaGroupCallback: UpdateReceiver? = null, - private val channelPostCallback: UpdateReceiver? = null, - private val channelPostMediaGroupCallback: UpdateReceiver? = null, - private val editedChannelPostCallback: UpdateReceiver? = null, - private val editedChannelPostMediaGroupCallback: UpdateReceiver? = null, - private val chosenInlineResultCallback: UpdateReceiver? = null, - private val inlineQueryCallback: UpdateReceiver? = null, - private val callbackQueryCallback: UpdateReceiver? = null, - private val shippingQueryCallback: UpdateReceiver? = null, - private val preCheckoutQueryCallback: UpdateReceiver? = null -) { - val asUpdateReceiver: UpdateReceiver = this::invoke - val allowedUpdates = listOfNotNull( - (messageCallback ?: messageMediaGroupCallback) ?.let { UPDATE_MESSAGE }, - (editedMessageCallback ?: editedMessageMediaGroupCallback) ?.let { UPDATE_EDITED_MESSAGE }, - (channelPostCallback ?: channelPostMediaGroupCallback) ?.let { UPDATE_CHANNEL_POST }, - (editedChannelPostCallback ?: editedChannelPostMediaGroupCallback) ?.let { UPDATE_EDITED_CHANNEL_POST }, - chosenInlineResultCallback ?.let { UPDATE_CHOSEN_INLINE_RESULT }, - inlineQueryCallback ?.let { UPDATE_INLINE_QUERY }, - callbackQueryCallback ?.let { UPDATE_CALLBACK_QUERY }, - shippingQueryCallback ?.let { UPDATE_SHIPPING_QUERY }, - preCheckoutQueryCallback ?.let { UPDATE_PRE_CHECKOUT_QUERY } +@Deprecated( + "Replaced in separated package", + ReplaceWith( + "UpdatesFilter", + "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter" ) +) +typealias UpdatesFilter = UpdatesFilter - suspend fun invoke(update: Update) { - when (update) { - is MessageUpdate -> messageCallback ?.invoke(update) - is MessageMediaGroupUpdate -> messageMediaGroupCallback ?.also { receiver -> - receiver(update) - } ?: messageCallback ?.also { receiver -> - update.origins.mapNotNull { it as? MessageUpdate }.forEach { - receiver(it) - } - } - is EditMessageUpdate -> editedMessageCallback ?.invoke(update) - is EditMessageMediaGroupUpdate -> editedMessageMediaGroupCallback ?.also { receiver -> - receiver(update) - } ?: editedMessageCallback ?.also { receiver -> - update.origins.mapNotNull { it as? EditMessageUpdate }.forEach { - receiver(it) - } - } - is ChannelPostUpdate -> channelPostCallback ?.invoke(update) - is ChannelPostMediaGroupUpdate -> channelPostMediaGroupCallback ?.also { receiver -> - receiver(update) - } ?: channelPostCallback ?.also { receiver -> - update.origins.mapNotNull { it as? ChannelPostUpdate }.forEach { - receiver(it) - } - } - is EditChannelPostUpdate -> editedChannelPostCallback ?.invoke(update) - is EditChannelPostMediaGroupUpdate -> editedChannelPostMediaGroupCallback ?.also { receiver -> - receiver(update) - } ?: editedChannelPostCallback ?.also { receiver -> - update.origins.mapNotNull { it as? EditChannelPostUpdate }.forEach { - receiver(it) - } - } - is ChosenInlineResultUpdate -> chosenInlineResultCallback ?.invoke(update) - is InlineQueryUpdate -> inlineQueryCallback ?.invoke(update) - is CallbackQueryUpdate -> callbackQueryCallback ?.invoke(update) - is ShippingQueryUpdate -> shippingQueryCallback ?.invoke(update) - is PreCheckoutQueryUpdate -> preCheckoutQueryCallback ?.invoke(update) - } - } -} - +@Deprecated( + "Replaced in separated package", + ReplaceWith( + "createSimpleUpdateFilter", + "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.createSimpleUpdateFilter" + ) +) fun createSimpleUpdateFilter( messageCallback: UpdateReceiver? = null, mediaGroupCallback: UpdateReceiver? = null, @@ -87,18 +31,15 @@ fun createSimpleUpdateFilter( callbackQueryCallback: UpdateReceiver? = null, shippingQueryCallback: UpdateReceiver? = null, preCheckoutQueryCallback: UpdateReceiver? = null -): UpdatesFilter = UpdatesFilter( - messageCallback = messageCallback, - messageMediaGroupCallback = mediaGroupCallback, - editedMessageCallback = editedMessageCallback, - editedMessageMediaGroupCallback = mediaGroupCallback, - channelPostCallback = channelPostCallback, - channelPostMediaGroupCallback = mediaGroupCallback, - editedChannelPostCallback = editedChannelPostCallback, - editedChannelPostMediaGroupCallback = mediaGroupCallback, - chosenInlineResultCallback = chosenInlineResultCallback, - inlineQueryCallback = inlineQueryCallback, - callbackQueryCallback = callbackQueryCallback, - shippingQueryCallback = shippingQueryCallback, - preCheckoutQueryCallback = preCheckoutQueryCallback +): UpdatesFilter = com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.createSimpleUpdateFilter( + messageCallback, + mediaGroupCallback, + editedMessageCallback, + channelPostCallback, + editedChannelPostCallback, + chosenInlineResultCallback, + inlineQueryCallback, + callbackQueryCallback, + shippingQueryCallback, + preCheckoutQueryCallback ) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt index 7ead0ba33b..1d87bd6c17 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPoller.kt @@ -1,96 +1,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils.extensions -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.GetUpdates -import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.DeleteWebhook -import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update -import com.github.insanusmokrassar.TelegramBotAPI.utils.mediaGroupId -import com.github.insanusmokrassar.TelegramBotAPI.utils.toMediaGroupUpdate -import kotlinx.coroutines.* -import java.util.concurrent.Executors +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesPoller -class UpdatesPoller( - private val executor: RequestsExecutor, - private val requestsDelayMillis: Long = 1000, - private val scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()), - private val allowedUpdates: List? = null, - private val block: UpdateReceiver -) { - private var lastHandledUpdate: UpdateIdentifier = 0L - private val mediaGroup: MutableList = mutableListOf() - - private var pollerJob: Job? = null - - private suspend fun sendToBlock(data: Update) { - block(data) - lastHandledUpdate = data.updateId - } - - private suspend fun pushMediaGroupUpdate(update: BaseMessageUpdate? = null) { - val inputMediaGroupId = (update ?.data as? MediaGroupMessage) ?.mediaGroupId - if (mediaGroup.isNotEmpty() && inputMediaGroupId ?.equals(mediaGroup.mediaGroupId) != true) { - mediaGroup.sortBy { it.updateId } - mediaGroup.toMediaGroupUpdate() ?.let { - sendToBlock(it) - } ?: mediaGroup.forEach { - sendToBlock(it) - } - mediaGroup.clear() - } - inputMediaGroupId ?.let { - mediaGroup.add(update) - } ?: sendToBlock(update ?: return) - } - - private suspend fun getUpdates(): List { - return executor.execute( - GetUpdates( - lastHandledUpdate + 1, // incremented because offset counted from 1 when updates id from 0 - allowed_updates = allowedUpdates - ) - ).map { - it.asUpdate - } - } - - private suspend fun handleUpdates(updates: List) { - for (update in updates) { - (update as? BaseMessageUpdate) ?.let { - if (it.data is MediaGroupMessage) { - pushMediaGroupUpdate(it) - } else { - null - } - } ?:let { - pushMediaGroupUpdate() - sendToBlock(update) - } - } - - pushMediaGroupUpdate() - } - - suspend fun start(): Job { - executor.executeUnsafe(DeleteWebhook()) - return pollerJob ?: scope.launch { - while (isActive) { - delay(requestsDelayMillis) - try { - val updates = getUpdates() - handleUpdates(updates) - } catch (e: Exception) { - e.printStackTrace() - } - } - }.also { - pollerJob = it - } - } - - suspend fun stop() { - pollerJob ?.cancelAndJoin() - } -} \ No newline at end of file +@Deprecated( + "Replaced in separated package", + ReplaceWith( + "UpdatesPoller", + "com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesPoller" + ) +) +typealias UpdatesPoller = UpdatesPoller diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt index 8777aec2f5..09250d70d5 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/UpdatesPolling.kt @@ -4,6 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.types.update.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesPoller import kotlinx.coroutines.* import java.util.concurrent.Executors diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt index c198a22872..85022a9fdc 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/Webhooks.kt @@ -8,8 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaG import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update +import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.UpdatesFilter import com.github.insanusmokrassar.TelegramBotAPI.utils.toMediaGroupUpdate -import io.ktor.application.Application import io.ktor.application.call import io.ktor.request.receiveText import io.ktor.response.respond