mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
commit
b9a136ff44
@ -1 +1,8 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.8.1
|
||||
|
||||
* Update `MediaGroupMessage` interface
|
||||
* Add implementation of `MediaGroupMessage`
|
||||
* Add generating of `MediaGroupMessage` in `RawMessage`
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
project.version = "0.8"
|
||||
project.version = "0.8.1"
|
||||
project.group = "com.github.insanusmokrassar"
|
||||
|
||||
buildscript {
|
||||
|
@ -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
|
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user