mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
fix of error inside of update utils for media groups
This commit is contained in:
parent
688de1053b
commit
3dd428c7d9
@ -27,6 +27,8 @@
|
||||
|
||||
### 0.25.1
|
||||
|
||||
* Fix of error inside of update utils for media groups
|
||||
|
||||
## 0.24.0
|
||||
|
||||
* `TelegramBotAPI`:
|
||||
|
@ -23,19 +23,19 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
||||
val resultUpdates = mutableListOf<Update>()
|
||||
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>()
|
||||
for (update in this) {
|
||||
val data = (update.data as? MediaGroupMessage)
|
||||
if (data == null) {
|
||||
resultUpdates.add(update)
|
||||
continue
|
||||
}
|
||||
when (update) {
|
||||
is BaseEditMessageUpdate -> resultUpdates.add(
|
||||
update.toEditMediaGroupUpdate()
|
||||
)
|
||||
is BaseSentMessageUpdate -> {
|
||||
val data = update.data
|
||||
if (data is MediaGroupMessage) {
|
||||
mediaGroups.getOrPut(data.mediaGroupId) {
|
||||
mutableListOf()
|
||||
}.add(update)
|
||||
} else {
|
||||
resultUpdates.add(update)
|
||||
}
|
||||
}
|
||||
else -> resultUpdates.add(update)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user