mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
fix of #732
This commit is contained in:
parent
f8cd446133
commit
818ef8481d
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## 6.1.0
|
## 6.1.0
|
||||||
|
|
||||||
|
* `API`:
|
||||||
|
* Fix of [#732](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/732)
|
||||||
|
|
||||||
## 6.0.3
|
## 6.0.3
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -5,7 +5,9 @@ import dev.inmo.tgbotapi.requests.DeleteMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
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.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@ -21,7 +23,16 @@ suspend fun TelegramBot.deleteMessage(
|
|||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
message: Message
|
message: Message
|
||||||
) = deleteMessage(message.chat, message.messageId)
|
): Boolean {
|
||||||
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupContent<*>)
|
||||||
|
if (mediaGroupContent == null) {
|
||||||
|
return deleteMessage(message.chat, message.messageId)
|
||||||
|
} else {
|
||||||
|
return mediaGroupContent.group.map {
|
||||||
|
deleteMessage(it.sourceMessage)
|
||||||
|
}.all { it }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user