mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-03-03 17:32:23 +00:00
preview version of threads in privats
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message
|
||||||
|
|
||||||
|
import korlibs.time.DateTime
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.chat.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.PrivateForumContentMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
|
||||||
|
data class PrivateForumContentMessageImpl<T: MessageContent>(
|
||||||
|
override val messageId: MessageId,
|
||||||
|
override val threadId: MessageThreadId,
|
||||||
|
override val threadCreatingInfo: ForumTopicCreated?,
|
||||||
|
override val from: User,
|
||||||
|
override val chat: PreviewPrivateChat,
|
||||||
|
override val content: T,
|
||||||
|
override val date: DateTime,
|
||||||
|
override val editDate: DateTime?,
|
||||||
|
override val hasProtectedContent: Boolean,
|
||||||
|
override val forwardOrigin: MessageOrigin?,
|
||||||
|
override val replyInfo: ReplyInfo?,
|
||||||
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
|
override val senderBot: CommonBot?,
|
||||||
|
override val mediaGroupId: MediaGroupId?,
|
||||||
|
override val fromOffline: Boolean,
|
||||||
|
override val effectId: EffectId?,
|
||||||
|
@SerialName(paidStarCountField)
|
||||||
|
override val cost: Int? = null
|
||||||
|
) : PrivateForumContentMessage<T> {
|
||||||
|
}
|
||||||
@@ -748,23 +748,51 @@ internal data class RawMessage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is PreviewPrivateChat -> if (business_connection_id == null) {
|
is PreviewPrivateChat -> if (business_connection_id == null) {
|
||||||
PrivateContentMessageImpl(
|
when {
|
||||||
messageId = messageId,
|
is_topic_message == true -> {
|
||||||
from = checkedFrom ?: from ?: error("Was detected common message, but owner (sender) of the message was not found"),
|
PrivateForumContentMessageImpl(
|
||||||
chat = chat,
|
messageId = messageId,
|
||||||
content = content,
|
from = checkedFrom ?: from
|
||||||
date = date.asDate,
|
?: error("Was detected common message, but owner (sender) of the message was not found"),
|
||||||
editDate = edit_date?.asDate,
|
threadId = messageThreadId
|
||||||
hasProtectedContent = has_protected_content == true,
|
?: error("Was detected forum private message, but message thread id was not found"),
|
||||||
forwardOrigin = forward_origin,
|
threadCreatingInfo = forum_topic_created,
|
||||||
replyInfo = replyInfo,
|
chat = chat,
|
||||||
replyMarkup = reply_markup,
|
content = content,
|
||||||
senderBot = via_bot,
|
date = date.asDate,
|
||||||
mediaGroupId = media_group_id,
|
editDate = edit_date?.asDate,
|
||||||
fromOffline = is_from_offline,
|
hasProtectedContent = has_protected_content == true,
|
||||||
effectId = effect_id,
|
forwardOrigin = forward_origin,
|
||||||
cost = paid_star_count,
|
replyInfo = replyInfo,
|
||||||
)
|
replyMarkup = reply_markup,
|
||||||
|
senderBot = via_bot,
|
||||||
|
mediaGroupId = media_group_id,
|
||||||
|
fromOffline = is_from_offline,
|
||||||
|
effectId = effect_id,
|
||||||
|
cost = paid_star_count,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
PrivateContentMessageImpl(
|
||||||
|
messageId = messageId,
|
||||||
|
from = checkedFrom ?: 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,
|
||||||
|
effectId = effect_id,
|
||||||
|
cost = paid_star_count,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
BusinessContentMessageImpl(
|
BusinessContentMessageImpl(
|
||||||
messageId = messageId,
|
messageId = messageId,
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
|
||||||
|
interface PrivateForumContentMessage<T: MessageContent> : PrivateContentMessage<T>, PossiblyTopicMessage {
|
||||||
|
override val threadId: MessageThreadId
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user