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

add support of inaccessible message

This commit is contained in:
InsanusMokrassar 2024-01-07 15:21:32 +06:00
parent 14756fd6e8
commit 5190f7b856
2 changed files with 16 additions and 0 deletions

View File

@ -287,6 +287,13 @@ internal data class RawMessage(
}
val asMessage: Message by lazy {
if (date.date == 0L) {
return@lazy InaccessibleMessage(
chat,
messageId
)
}
try {
chatEvent?.let { chatEvent ->
when (chat) {

View File

@ -19,6 +19,15 @@ interface Message : WithPreviewChatAndMessageId {
val date: DateTime
}
@Serializable
data class InaccessibleMessage(
override val chat: PreviewChat,
override val messageId: MessageId,
) : Message {
override val date: DateTime
get() = DateTime.invoke(0L)
}
data class UnknownMessageType(
override val messageId: MessageId,
override val chat: PreviewChat,