diff --git a/CHANGELOG.md b/CHANGELOG.md index cf159eaa69..3490340bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # TelegramBotAPI changelog +## 6.1.0 + +* `Versions`: + * `MicroUtils`: `0.17.2` -> `0.17.3` +* `API`: + * Fix of [#732](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/732) + ## 6.0.3 * `Versions`: diff --git a/gradle.properties b/gradle.properties index b9f70cd8d1..9c2d8b6297 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.incremental=true kotlin.incremental.js=true library_group=dev.inmo -library_version=6.0.3 +library_version=6.1.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 404d430f4f..2187d2ec0f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ ktor = "2.2.4" ksp = "1.8.10-1.0.9" kotlin-poet = "1.12.0" -microutils = "0.17.2" +microutils = "0.17.3" github-release-plugin = "2.4.1" dokka = "1.8.10" diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt index 8e9fc661ca..90c7f00b35 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/DeleteMessage.kt @@ -5,7 +5,10 @@ import dev.inmo.tgbotapi.requests.DeleteMessage import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.Message +import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent +import dev.inmo.tgbotapi.types.message.content.MediaGroupContent suspend fun TelegramBot.deleteMessage( chatId: ChatIdentifier, @@ -21,7 +24,16 @@ suspend fun TelegramBot.deleteMessage( suspend fun TelegramBot.deleteMessage( message: Message -) = deleteMessage(message.chat, message.messageId) +): Boolean { + val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>) + if (mediaGroupContent == null) { + return deleteMessage(message.chat, message.messageId) + } else { + return mediaGroupContent.group.map { + deleteMessage(it.sourceMessage) + }.all { it } + } +} suspend fun TelegramBot.delete( chatId: ChatIdentifier,