mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 03:28:44 +00:00
media group messages order
This commit is contained in:
parent
7d7a6ccf80
commit
37c112f6ab
@ -47,6 +47,7 @@ will not contain `user` field (but `CommonMediaGroupMessage` will have)
|
|||||||
* Now `MediaCollectionContent` is `MediaContent` (classes of this interface must choose best
|
* Now `MediaCollectionContent` is `MediaContent` (classes of this interface must choose best
|
||||||
media for present out)
|
media for present out)
|
||||||
* `PhotoContent` now choose biggest photo size from its collection as `media`
|
* `PhotoContent` now choose biggest photo size from its collection as `media`
|
||||||
|
* Fix in order of media group messages which was received by webhooks
|
||||||
|
|
||||||
## 0.11.0
|
## 0.11.0
|
||||||
|
|
||||||
|
@ -5,11 +5,12 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
|
||||||
|
|
||||||
fun List<BaseMessageUpdate>.toMediaGroupUpdate(): MediaGroupUpdate? = (this as? MediaGroupUpdate) ?: let {
|
fun List<BaseMessageUpdate>.toMediaGroupUpdate(): MediaGroupUpdate? = (this as? MediaGroupUpdate) ?: let {
|
||||||
|
val resultList = sortedBy { it.updateId }
|
||||||
when (first()) {
|
when (first()) {
|
||||||
is MessageUpdate -> MessageMediaGroupUpdate(this)
|
is MessageUpdate -> MessageMediaGroupUpdate(resultList)
|
||||||
is EditMessageUpdate -> EditMessageMediaGroupUpdate(this)
|
is EditMessageUpdate -> EditMessageMediaGroupUpdate(resultList)
|
||||||
is ChannelPostUpdate -> ChannelPostMediaGroupUpdate(this)
|
is ChannelPostUpdate -> ChannelPostMediaGroupUpdate(resultList)
|
||||||
is EditChannelPostUpdate -> EditChannelPostMediaGroupUpdate(this)
|
is EditChannelPostUpdate -> EditChannelPostMediaGroupUpdate(resultList)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user