1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

MediaGroupMessage is CommonMessage

This commit is contained in:
InsanusMokrassar 2019-02-17 14:29:17 +08:00
parent 03e7ca532d
commit e774f958af
5 changed files with 18 additions and 6 deletions

View File

@ -15,6 +15,7 @@
* Change algorithm of `executeUnsafe`: now it use loop instead of recursive calling * Change algorithm of `executeUnsafe`: now it use loop instead of recursive calling
* Add additional `startGettingUpdates` with better management of received updates for media groups * Add additional `startGettingUpdates` with better management of received updates for media groups
* Now `MediaGroupMessage` is `CommonMessage` with `MediaGroupContent` content
## 0.9.0 ## 0.9.0

View File

@ -13,5 +13,8 @@ data class CommonMediaGroupMessage(
override val chat: Chat, override val chat: Chat,
override val date: DateTime, override val date: DateTime,
override val mediaGroupId: MediaGroupIdentifier, override val mediaGroupId: MediaGroupIdentifier,
override val content: MediaGroupContent override val content: MediaGroupContent,
override val editDate: DateTime?,
override val forwarded: ForwardedMessage?,
override val replyTo: Message?
) : Message, MediaGroupMessage, FromUserMessage ) : Message, MediaGroupMessage, FromUserMessage

View File

@ -13,5 +13,8 @@ data class MediaGroupMessage(
override val chat: Chat, override val chat: Chat,
override val date: DateTime, override val date: DateTime,
override val mediaGroupId: MediaGroupIdentifier, override val mediaGroupId: MediaGroupIdentifier,
override val content: MediaGroupContent override val content: MediaGroupContent,
override val editDate: DateTime?,
override val forwarded: ForwardedMessage?,
override val replyTo: Message?
) : Message, MediaGroupMessage ) : Message, MediaGroupMessage

View File

@ -219,7 +219,10 @@ data class RawMessage(
is PhotoContent -> content is PhotoContent -> content
is VideoContent -> content is VideoContent -> content
else -> throw IllegalStateException("Unsupported content for media group") else -> throw IllegalStateException("Unsupported content for media group")
} },
edit_date ?.asDate,
forwarded,
reply_to_message ?.asMessage
) )
else -> CommonMediaGroupMessage( else -> CommonMediaGroupMessage(
messageId, messageId,
@ -231,7 +234,10 @@ data class RawMessage(
is PhotoContent -> content is PhotoContent -> content
is VideoContent -> content is VideoContent -> content
else -> throw IllegalStateException("Unsupported content for media group") else -> throw IllegalStateException("Unsupported content for media group")
} },
edit_date ?.asDate,
forwarded,
reply_to_message ?.asMessage
) )
} }
} ?: when (chat) { } ?: when (chat) {

View File

@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
interface MediaGroupMessage : Message { interface MediaGroupMessage : CommonMessage<MediaGroupContent> {
val mediaGroupId: MediaGroupIdentifier val mediaGroupId: MediaGroupIdentifier
val content: MediaGroupContent
} }