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
|
### 0.25.1
|
||||||
|
|
||||||
|
* Fix of error inside of update utils for media groups
|
||||||
|
|
||||||
## 0.24.0
|
## 0.24.0
|
||||||
|
|
||||||
* `TelegramBotAPI`:
|
* `TelegramBotAPI`:
|
||||||
|
@ -23,19 +23,19 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
|||||||
val resultUpdates = mutableListOf<Update>()
|
val resultUpdates = mutableListOf<Update>()
|
||||||
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>()
|
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>()
|
||||||
for (update in this) {
|
for (update in this) {
|
||||||
|
val data = (update.data as? MediaGroupMessage)
|
||||||
|
if (data == null) {
|
||||||
|
resultUpdates.add(update)
|
||||||
|
continue
|
||||||
|
}
|
||||||
when (update) {
|
when (update) {
|
||||||
is BaseEditMessageUpdate -> resultUpdates.add(
|
is BaseEditMessageUpdate -> resultUpdates.add(
|
||||||
update.toEditMediaGroupUpdate()
|
update.toEditMediaGroupUpdate()
|
||||||
)
|
)
|
||||||
is BaseSentMessageUpdate -> {
|
is BaseSentMessageUpdate -> {
|
||||||
val data = update.data
|
mediaGroups.getOrPut(data.mediaGroupId) {
|
||||||
if (data is MediaGroupMessage) {
|
mutableListOf()
|
||||||
mediaGroups.getOrPut(data.mediaGroupId) {
|
}.add(update)
|
||||||
mutableListOf()
|
|
||||||
}.add(update)
|
|
||||||
} else {
|
|
||||||
resultUpdates.add(update)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else -> resultUpdates.add(update)
|
else -> resultUpdates.add(update)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user