1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

add support of personal chat, is_from_offline and can_connect_to_business

This commit is contained in:
InsanusMokrassar 2024-04-16 22:57:07 +06:00
parent 64ef0fa160
commit 953bdef657
11 changed files with 247 additions and 195 deletions

View File

@ -150,6 +150,7 @@ const val accentColorIdField = "accent_color_id"
const val profileAccentColorIdField = "profile_accent_color_id"
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
const val personalChatField = "personal_chat"
const val hasVisibleHistoryField = "has_visible_history"
const val unrestrictBoostsCountField = "unrestrict_boost_count"
const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name"
@ -158,6 +159,7 @@ const val canJoinGroupsField = "can_join_groups"
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
const val canReplyField = "can_reply"
const val supportInlineQueriesField = "supports_inline_queries"
const val canConnectToBusinessField = "can_connect_to_business"
const val textEntitiesField = "text_entities"
const val entitiesField = "entities"
const val stickerSetNameField = "set_name"

View File

@ -133,6 +133,9 @@ data class ExtendedPrivateChatImpl(
override val businessLocation: BusinessLocation? = null,
@SerialName(businessOpeningHoursField)
override val businessOpeningHours: BusinessOpeningHours? = null,
@SerialName(personalChatField)
@Serializable(PreviewChatSerializer::class)
override val personalChat: PreviewChannelChat? = null
) : ExtendedPrivateChat
typealias ExtendedUser = ExtendedPrivateChatImpl
@ -277,6 +280,8 @@ data class ExtendedBot(
val canReadAllGroupMessages: Boolean = false,
@SerialName(supportInlineQueriesField)
val supportsInlineQueries: Boolean = false,
@SerialName(canConnectToBusinessField)
val canConnectToBusiness: Boolean = false,
@SerialName(photoField)
override val chatPhoto: ChatPhoto? = null,
@SerialName(accentColorIdField)

View File

@ -46,6 +46,8 @@ sealed interface ExtendedPrivateChat : PrivateChat, ExtendedChatWithUsername, Ex
val businessLocation: BusinessLocation?
val businessOpeningHours: BusinessOpeningHours?
val personalChat: PreviewChannelChat?
val allowCreateUserIdLink: Boolean
get() = hasPrivateForwards
}

View File

@ -26,7 +26,8 @@ data class BusinessContentMessageImpl<T: MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val senderBusinessBot: PreviewBot? = null
override val senderBusinessBot: PreviewBot?,
override val fromOffline: Boolean,
) : BusinessContentMessage<T> {
constructor(
messageId: MessageId,
@ -42,7 +43,8 @@ data class BusinessContentMessageImpl<T: MessageContent>(
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
senderBusinessBot: PreviewBot? = null,
senderBusinessBot: PreviewBot?,
fromOffline: Boolean,
) : this(
messageId = messageId,
from = from,
@ -57,6 +59,7 @@ data class BusinessContentMessageImpl<T: MessageContent>(
replyMarkup = replyMarkup,
senderBot = senderBot,
mediaGroupId = mediaGroupId,
senderBusinessBot = senderBusinessBot
senderBusinessBot = senderBusinessBot,
fromOffline = fromOffline
)
}

View File

@ -21,6 +21,7 @@ data class ChannelContentMessageImpl<T: MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : ChannelContentMessage<T> {
constructor(
messageId: MessageId,
@ -35,7 +36,8 @@ data class ChannelContentMessageImpl<T: MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
messageId, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId
messageId, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, authorSignature, mediaGroupId, fromOffline
)
}

View File

@ -23,6 +23,7 @@ data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : ConnectedFromChannelGroupContentMessage<T> {
constructor(
@ -39,8 +40,9 @@ data class ConnectedFromChannelGroupContentMessageImpl<T : MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId, fromOffline
)
}
@ -58,6 +60,7 @@ data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : UnconnectedFromChannelGroupContentMessage<T> {
constructor(
chat: PreviewGroupChat,
@ -73,8 +76,9 @@ data class UnconnectedFromChannelGroupContentMessageImpl<T: MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
chat, channel, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId, fromOffline
)
}
@ -91,6 +95,7 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : AnonymousGroupContentMessage<T> {
constructor(
chat: PreviewGroupChat,
@ -105,8 +110,9 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
chat, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
chat, messageId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId, fromOffline
)
}
@ -123,7 +129,8 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
override val content: T,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val senderBoostsCount: Int?
override val senderBoostsCount: Int?,
override val fromOffline: Boolean,
) : CommonGroupContentMessage<T> {
constructor(
chat: PreviewGroupChat,
@ -139,8 +146,9 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
senderBoostsCount: Int?,
fromOffline: Boolean,
) : this(
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount, fromOffline
)
}
@ -159,6 +167,7 @@ data class FromChannelForumContentMessageImpl<T: MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : FromChannelForumContentMessage<T> {
constructor(
chat: PreviewForumChat,
@ -175,8 +184,9 @@ data class FromChannelForumContentMessageImpl<T: MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
chat, channel, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
chat, channel, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId, fromOffline
)
}
@ -194,6 +204,7 @@ data class AnonymousForumContentMessageImpl<T : MessageContent>(
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : AnonymousForumContentMessage<T> {
constructor(
chat: PreviewForumChat,
@ -209,8 +220,9 @@ data class AnonymousForumContentMessageImpl<T : MessageContent>(
senderBot: CommonBot?,
authorSignature: AuthorSignature?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
chat, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId
chat, messageId, threadId, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, authorSignature, mediaGroupId, fromOffline
)
}
@ -229,6 +241,7 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val senderBoostsCount: Int?,
override val fromOffline: Boolean,
) : CommonForumContentMessage<T> {
constructor(
chat: PreviewForumChat,
@ -245,7 +258,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
senderBoostsCount: Int?,
fromOffline: Boolean,
) : this(
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount, fromOffline
)
}

View File

@ -23,6 +23,7 @@ data class PrivateContentMessageImpl<T: MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val fromOffline: Boolean,
) : PrivateContentMessage<T> {
constructor(
messageId: MessageId,
@ -37,7 +38,8 @@ data class PrivateContentMessageImpl<T: MessageContent>(
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
fromOffline: Boolean,
) : this(
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId
messageId, from, chat, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId, fromOffline
)
}

View File

@ -105,6 +105,8 @@ internal data class RawMessage(
private val users_shared: UsersShared? = null,
private val chat_shared: ChatShared? = null,
private val is_from_offline: Boolean = false,
// Voice Chat Service Messages
private val video_chat_scheduled: VideoChatScheduled? = null,
private val video_chat_started: VideoChatStarted? = null,
@ -313,18 +315,19 @@ internal data class RawMessage(
when (chat) {
is PreviewPublicChat -> when (chat) {
is PreviewChannelChat -> ChannelContentMessageImpl(
messageId,
chat,
content,
date.asDate,
edit_date?.asDate,
has_protected_content == true,
forward_origin,
replyInfo,
reply_markup,
via_bot,
author_signature,
media_group_id
messageId = messageId,
chat = chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
is PreviewForumChat -> if (messageThreadId != null) {
val chatId = ChatIdWithThreadId(
@ -336,218 +339,231 @@ internal data class RawMessage(
}
when (sender_chat) {
is PreviewChannelChat -> FromChannelForumContentMessageImpl(
actualForumChat,
sender_chat,
messageId,
messageThreadId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = actualForumChat,
channel = sender_chat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
is PreviewGroupChat -> AnonymousForumContentMessageImpl(
actualForumChat,
messageId,
messageThreadId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
null -> CommonForumContentMessageImpl(
actualForumChat,
messageId,
messageThreadId,
from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
media_group_id,
sender_boost_count
chat = actualForumChat,
messageId = messageId,
threadId = messageThreadId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline
)
}
} else {
when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat,
sender_chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat,
sender_chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
}
is GroupChat -> AnonymousGroupContentMessageImpl(
chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
null -> CommonGroupContentMessageImpl(
chat,
messageId,
from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
media_group_id,
sender_boost_count
chat = chat,
messageId = messageId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline
)
}
}
is PreviewGroupChat -> when (sender_chat) {
is PreviewChannelChat -> if (is_automatic_forward == true) {
ConnectedFromChannelGroupContentMessageImpl(
chat,
sender_chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
} else {
UnconnectedFromChannelGroupContentMessageImpl(
chat,
sender_chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
channel = sender_chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
}
is PreviewGroupChat -> AnonymousGroupContentMessageImpl(
chat,
messageId,
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
author_signature,
media_group_id
chat = chat,
messageId = messageId,
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
authorSignature = author_signature,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
null -> CommonGroupContentMessageImpl(
chat,
messageId,
from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date.asDate,
forward_origin,
edit_date ?.asDate,
has_protected_content == true,
replyInfo,
reply_markup,
content,
via_bot,
media_group_id,
sender_boost_count
chat = chat,
messageId = messageId,
from = from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date = date.asDate,
forwardOrigin = forward_origin,
editDate = edit_date ?.asDate,
hasProtectedContent = has_protected_content == true,
replyInfo = replyInfo,
replyMarkup = reply_markup,
content = content,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBoostsCount = sender_boost_count,
fromOffline = is_from_offline
)
}
}
is PreviewPrivateChat -> if (business_connection_id == null) {
PrivateContentMessageImpl(
messageId,
from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat,
content,
date.asDate,
edit_date?.asDate,
has_protected_content == true,
forward_origin,
replyInfo,
reply_markup,
via_bot,
media_group_id
messageId = messageId,
from = from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = chat,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
fromOffline = is_from_offline
)
} else {
BusinessContentMessageImpl(
messageId,
from ?: error("Was detected common message, but owner (sender) of the message was not found"),
BusinessChatImpl(
messageId = messageId,
from = from ?: error("Was detected common message, but owner (sender) of the message was not found"),
chat = BusinessChatImpl(
chat.id.toBusinessChatId(business_connection_id),
chat
),
business_connection_id,
content,
date.asDate,
edit_date?.asDate,
has_protected_content == true,
forward_origin,
replyInfo,
reply_markup,
via_bot,
media_group_id,
sender_business_bot
businessConnectionId = business_connection_id,
content = content,
date = date.asDate,
editDate = edit_date?.asDate,
hasProtectedContent = has_protected_content == true,
forwardOrigin = forward_origin,
replyInfo = replyInfo,
replyMarkup = reply_markup,
senderBot = via_bot,
mediaGroupId = media_group_id,
senderBusinessBot = sender_business_bot,
fromOffline = is_from_offline
)
}
else -> error("Unknown type of chat: $chat")

View File

@ -8,5 +8,6 @@ sealed interface CommonMessage<out T: MessageContent> : AccessibleMessage,
PossiblyReplyMessage,
PossiblyMarkedUp,
PossiblyBusinessMessage,
PossiblyOfflineMessage,
PossiblyMediaGroupMessage<T>,
ContentMessage<T>

View File

@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
interface PossiblyOfflineMessage : Message {
val fromOffline: Boolean
}

View File

@ -3,6 +3,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage {
interface PrivateContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, FromUserMessage, PossiblyOfflineMessage {
override val chat: PreviewPrivateChat
}