From bef5a6967a1b65defed97daeb81769ca41e010ff Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Fri, 8 Dec 2023 21:20:59 -0500 Subject: [PATCH] added replyNotice, comments and smthn to ref objs --- src/MatrixClient.nim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/MatrixClient.nim b/src/MatrixClient.nim index c11103f..89263c3 100644 --- a/src/MatrixClient.nim +++ b/src/MatrixClient.nim @@ -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 \ No newline at end of file