mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
add support of inaccessible message
This commit is contained in:
parent
14756fd6e8
commit
5190f7b856
@ -287,6 +287,13 @@ internal data class RawMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val asMessage: Message by lazy {
|
val asMessage: Message by lazy {
|
||||||
|
if (date.date == 0L) {
|
||||||
|
return@lazy InaccessibleMessage(
|
||||||
|
chat,
|
||||||
|
messageId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
chatEvent?.let { chatEvent ->
|
chatEvent?.let { chatEvent ->
|
||||||
when (chat) {
|
when (chat) {
|
||||||
|
@ -19,6 +19,15 @@ interface Message : WithPreviewChatAndMessageId {
|
|||||||
val date: DateTime
|
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(
|
data class UnknownMessageType(
|
||||||
override val messageId: MessageId,
|
override val messageId: MessageId,
|
||||||
override val chat: PreviewChat,
|
override val chat: PreviewChat,
|
||||||
|
Loading…
Reference in New Issue
Block a user