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

seal of MediaGroupUpdates

This commit is contained in:
InsanusMokrassar 2021-06-30 11:12:09 +06:00
parent 65801f5104
commit 6ba9a31fb9
3 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,8 @@
* Added `Update#sourceUser` method
* More types assumed as sent by user types now implements `FromUser` interface
* Added `Any#whenFromUser`, `Any#asFromUser` and`Any#requireFromUser` extensions
* `MedaGroupUpdate` and its direct extenders `SentMediaGroupUpdate` and `EditMediaGroupUpdate` became
`sealed interface`s
* `Behaviour Builder`:
* ❗️ All triggers (`on*` extensions) have been modified to work in parallel by some marker by default (new parameter
`markerFactory`, in most cases will work async for different chats)

View File

@ -11,14 +11,14 @@ import dev.inmo.tgbotapi.types.update.abstracts.*
* @see dev.inmo.tgbotapi.extensions.api.SetWebhookKt.includeWebhookInRoute
* @see dev.inmo.tgbotapi.extensions.api.updates.UpdatesPollingKt.startGettingOfUpdates
*/
interface MediaGroupUpdate : Update
sealed interface MediaGroupUpdate : Update
interface SentMediaGroupUpdate: MediaGroupUpdate {
sealed interface SentMediaGroupUpdate: MediaGroupUpdate {
override val data: List<MediaGroupMessage<MediaGroupContent>>
val origins: List<BaseMessageUpdate>
}
interface EditMediaGroupUpdate : BaseEditMessageUpdate, MediaGroupUpdate {
sealed interface EditMediaGroupUpdate : BaseEditMessageUpdate, MediaGroupUpdate {
override val data: MediaGroupMessage<MediaGroupContent>
val origin: BaseMessageUpdate
}

View File

@ -17,7 +17,6 @@ fun Update.sourceChat(): Chat? = when (this) {
is MediaGroupUpdate -> when (this) {
is SentMediaGroupUpdate -> data.chat
is EditMediaGroupUpdate -> data.chat
else -> null
}
is BaseMessageUpdate -> data.chat
is InlineQueryUpdate -> data.from