1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

MediaGroupList extensions

This commit is contained in:
InsanusMokrassar 2019-02-17 14:40:43 +08:00
parent e774f958af
commit 1d1ac9040c
2 changed files with 21 additions and 0 deletions

View File

@ -16,6 +16,8 @@
* Change algorithm of `executeUnsafe`: now it use loop instead of recursive calling
* Add additional `startGettingUpdates` with better management of received updates for media groups
* Now `MediaGroupMessage` is `CommonMessage` with `MediaGroupContent` content
* Added extensions `replyTo`, `forwarded` and `chat` for `List<BaseMessageUpdated` for comfortable
work with media groups
## 0.9.0

View File

@ -0,0 +1,19 @@
package com.github.insanusmokrassar.TelegramBotAPI.utils
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.ForwardedMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
val List<BaseMessageUpdate>.forwarded: ForwardedMessage?
get() = first().let {
(it as? AbleToBeForwardedMessage) ?.forwarded
}
val List<BaseMessageUpdate>.replyTo: Message?
get() = first().let {
(it as? AbleToReplyMessage) ?.replyTo
}
val List<BaseMessageUpdate>.chat: Chat?
get() = first().data.chat