feat: add syncedFrom and syncedTo chat attributes
This commit is contained in:
parent
c858eed50f
commit
d762d5e021
|
@ -44,6 +44,8 @@ type Chat* = ref object
|
||||||
canPost*: bool
|
canPost*: bool
|
||||||
ensName*: string
|
ensName*: string
|
||||||
position*: int
|
position*: int
|
||||||
|
syncedFrom*: int64
|
||||||
|
syncedTo*: int64
|
||||||
|
|
||||||
proc `$`*(self: Chat): string =
|
proc `$`*(self: Chat): string =
|
||||||
result = fmt"Chat(id:{self.id}, name:{self.name}, active:{self.isActive}, type:{self.chatType})"
|
result = fmt"Chat(id:{self.id}, name:{self.name}, active:{self.isActive}, type:{self.chatType})"
|
||||||
|
@ -64,7 +66,9 @@ proc toJsonNode*(self: Chat): JsonNode =
|
||||||
"timestamp": self.timestamp,
|
"timestamp": self.timestamp,
|
||||||
"unviewedMessagesCount": self.unviewedMessagesCount,
|
"unviewedMessagesCount": self.unviewedMessagesCount,
|
||||||
"joined": self.joined,
|
"joined": self.joined,
|
||||||
"position": self.position
|
"position": self.position,
|
||||||
|
"syncedFrom": self.syncedFrom,
|
||||||
|
"syncedTo": self.syncedTo,
|
||||||
}
|
}
|
||||||
|
|
||||||
proc toChatMember*(jsonMember: JsonNode): ChatMember =
|
proc toChatMember*(jsonMember: JsonNode): ChatMember =
|
||||||
|
@ -116,7 +120,9 @@ proc toChat*(jsonChat: JsonNode): Chat =
|
||||||
muted: false,
|
muted: false,
|
||||||
ensName: "",
|
ensName: "",
|
||||||
joined: 0,
|
joined: 0,
|
||||||
private: jsonChat{"private"}.getBool
|
private: jsonChat{"private"}.getBool,
|
||||||
|
syncedFrom: jsonChat{"syncedFrom"}.getBiggestInt,
|
||||||
|
syncedTo: jsonChat{"syncedTo"}.getBiggestInt,
|
||||||
)
|
)
|
||||||
|
|
||||||
if jsonChat.hasKey("muted") and jsonChat["muted"].kind != JNull:
|
if jsonChat.hasKey("muted") and jsonChat["muted"].kind != JNull:
|
||||||
|
|
Loading…
Reference in New Issue