mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
fix of #732
This commit is contained in:
parent
f8cd446133
commit
818ef8481d
@ -2,6 +2,9 @@
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* `API`:
|
||||
* Fix of [#732](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/732)
|
||||
|
||||
## 6.0.3
|
||||
|
||||
* `Versions`:
|
||||
|
@ -5,7 +5,9 @@ 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.MediaGroupContent
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
chatId: ChatIdentifier,
|
||||
@ -21,7 +23,16 @@ suspend fun TelegramBot.deleteMessage(
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
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(
|
||||
chatId: ChatIdentifier,
|
||||
|
Loading…
Reference in New Issue
Block a user