diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChannelContentMessageImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChannelContentMessageImpl.kt index 50bea7370e..9e845ebf7d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChannelContentMessageImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/ChannelContentMessageImpl.kt @@ -5,14 +5,15 @@ import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.CommonBot import dev.inmo.tgbotapi.types.chat.PreviewChannelChat +import dev.inmo.tgbotapi.types.chat.PreviewChat import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.abstracts.* import dev.inmo.tgbotapi.types.message.content.MessageContent data class ChannelContentMessageImpl( override val messageId: MessageId, - override val from: User?, override val chat: PreviewChannelChat, + override val senderChat: PreviewChat, override val content: T, override val date: DateTime, override val editDate: DateTime?, @@ -27,8 +28,8 @@ data class ChannelContentMessageImpl( ) : ChannelContentMessage { constructor( messageId: MessageId, - from: User?, chat: PreviewChannelChat, + senderChat: PreviewChat, content: T, date: DateTime, editDate: DateTime?, @@ -41,6 +42,6 @@ data class ChannelContentMessageImpl( mediaGroupId: MediaGroupId?, fromOffline: Boolean, ) : this( - messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId, fromOffline + messageId, chat, senderChat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId, fromOffline ) } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index ae73502f94..88a9651fd9 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -51,7 +51,7 @@ internal data class RawMessage( private val chat: PreviewChat, @SerialName(messageThreadIdField) private val messageThreadId: MessageThreadId? = null, - private val from: User? = null, + private val from: PreviewUser? = null, private val sender_chat: PreviewPublicChat? = null, private val forward_origin: MessageOrigin? = null, private val is_topic_message: Boolean? = null, @@ -339,8 +339,8 @@ internal data class RawMessage( is PreviewPublicChat -> when (chat) { is PreviewChannelChat -> ChannelContentMessageImpl( messageId = messageId, - from = checkedFrom ?: from, chat = chat, + senderChat = checkedFrom ?: sender_chat ?: chat, content = content, date = date.asDate, editDate = edit_date?.asDate, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/ChannelContentMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/ChannelContentMessage.kt index 435466e558..0781e52cd4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/ChannelContentMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/abstracts/ChannelContentMessage.kt @@ -1,11 +1,11 @@ package dev.inmo.tgbotapi.types.message.abstracts -import dev.inmo.tgbotapi.types.chat.ChannelChat import dev.inmo.tgbotapi.types.chat.PreviewChannelChat +import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.message.content.MessageContent interface ChannelContentMessage : PossiblySentViaBotCommonMessage, SignedMessage, WithSenderChatMessage, OptionallyFromUserMessage { override val chat: PreviewChannelChat - override val senderChat: PreviewChannelChat - get() = chat + override val from: User? + get() = senderChat as? User }