added replyNotice, comments and smthn to ref objs

This commit is contained in:
array-in-a-matrix 2023-12-08 21:20:59 -05:00
parent 94fe7acffe
commit bef5a6967a

View file

@ -14,9 +14,13 @@ type Client = ref object
type Content = ref object
body*, msgtype*: cstring
type Unsigned = ref object
transaction_id*: cstring
type Event* = ref object
content*: Content
event_id*, sender*, `type`*: string
unsigned*: Unsigned
event_id*, sender*, `type`*, room_id*: string
origin_server_ts*: int
@ -24,7 +28,11 @@ proc newMatrixClient*(homeserver, token: cstring): Client {.importjs: "new Matri
proc newMatrixClient*(homeserver, token: cstring, storage: storage): Client {.importjs: "new MatrixClient(#, #, #)".}
proc newMatrixClient*(homeserver, token: cstring, storage: storage, cryptoStore: cryptoStore): Client {.importjs: "new MatrixClient(#, #, #, #)".}
proc start*(client: Client) {.importjs: "#.start()".} # returns a promise tho
# proc start*(client: Client, filter) {.importjs: "#.start(#)".}
proc start*(client: Client) {.importjs: "#.start()".} #? returns a promise
# TODO: proc start*(client: Client, filter) {.importjs: "#.start(#)".}
proc onRoomMessage*(client: Client, callback: proc(roomId: cstring, event: Event)) {.importjs: "#.on('room.message', #)".}
# TODO: add more for each event name
proc replyNotice*(client: Client, roomId: cstring, event: Event, text: cstring) {.importjs: "#.replyNotice(#, #, #)".} #? returns a promise
proc replyNotice*(client: Client, roomId: cstring, event: Event, text: cstring, html: cstring) {.importjs: "#.replyNotice(#, #, #, #)".} #? returns a promise