TelegramBotApiLibraries/resender/src/commonMain/kotlin/MessageMetaInfo.kt

19 lines
632 B
Kotlin
Raw Normal View History

2023-01-14 16:37:56 +00:00
package dev.inmo.tgbotapi.libraries.resender
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage
import kotlinx.serialization.Serializable
@Serializable
data class MessageMetaInfo(
val chatId: IdChatIdentifier,
val messageId: MessageId,
val group: String? = null
)
operator fun MessageMetaInfo.Companion.invoke(
message: Message
) = MessageMetaInfo(message.chat.id, message.messageId, (message as? PossiblyMediaGroupMessage<*>) ?.mediaGroupId)