2022-08-18 12:59:05 +00:00
|
|
|
package dev.inmo.plaguposter.posts.models
|
|
|
|
|
2022-08-19 18:24:00 +00:00
|
|
|
import dev.inmo.tgbotapi.extensions.utils.mediaGroupMessageOrNull
|
2022-08-18 12:59:05 +00:00
|
|
|
import dev.inmo.tgbotapi.types.ChatId
|
|
|
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
2022-08-19 18:24:00 +00:00
|
|
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
|
|
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
2022-08-18 12:59:05 +00:00
|
|
|
import kotlinx.serialization.Serializable
|
|
|
|
|
|
|
|
@Serializable
|
|
|
|
data class PostContentInfo(
|
|
|
|
val chatId: ChatId,
|
|
|
|
val messageId: MessageIdentifier,
|
|
|
|
val group: String?,
|
|
|
|
val order: Int
|
2022-08-19 18:24:00 +00:00
|
|
|
) {
|
|
|
|
companion object {
|
|
|
|
fun fromMessage(message: ContentMessage<*>, order: Int) = PostContentInfo(
|
|
|
|
message.chat.id,
|
|
|
|
message.messageId,
|
|
|
|
message.mediaGroupMessageOrNull() ?.mediaGroupId,
|
|
|
|
order
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|