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

Merge pull request #4 from InsanusMokrassar/0.8.1

0.8.1
This commit is contained in:
InsanusMokrassar 2019-01-01 18:16:44 +08:00 committed by GitHub
commit b9a136ff44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 6 deletions

View File

@ -1 +1,8 @@
# TelegramBotAPI changelog
# TelegramBotAPI changelog
## 0.8.1
* Update `MediaGroupMessage` interface
* Add implementation of `MediaGroupMessage`
* Add generating of `MediaGroupMessage` in `RawMessage`

View File

@ -1,4 +1,4 @@
project.version = "0.8"
project.version = "0.8.1"
project.group = "com.github.insanusmokrassar"
buildscript {

View File

@ -0,0 +1,17 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
import org.joda.time.DateTime
data class MediaGroupMessage(
override val messageId: MessageIdentifier,
override val chat: Chat,
override val date: DateTime,
override val mediaGroupId: MediaGroupIdentifier,
override val content: MediaGroupContent
) : Message, MediaGroupMessage

View File

@ -207,7 +207,19 @@ data class RawMessage(
}
} ?: content ?.let {
content ->
when (chat) {
media_group_id ?.let {
MediaGroupMessage(
messageId,
chat,
date.asDate,
it,
when (content) {
is PhotoContent -> content
is VideoContent -> content
else -> throw IllegalStateException("Unsupported content for media group")
}
)
} ?: when (chat) {
is ChannelChat -> ChannelMessage(
messageId,
chat,

View File

@ -1,8 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
interface MediaGroupMessage<T: MediaGroupContent> {
val mediaGroupId: String
val content: T
interface MediaGroupMessage : Message {
val mediaGroupId: MediaGroupIdentifier
val content: MediaGroupContent
}