basic example of a ping bot

This commit is contained in:
array-in-a-matrix 2023-12-08 21:21:29 -05:00
parent 74d70123ec
commit 9f80848179

15
examples/echo.nim Normal file
View file

@ -0,0 +1,15 @@
import ../nimbotsdk
const
homeserver: cstring = "https://matrix.example.xyz"
token: cstring = "token"
let client = newMatrixClient(homeserver, token)
client.start()
client.onRoomMessage(proc(roomId: cstring, event: Event) =
if(event.content.body == "ping"):
client.replyNotice(roomId, event, "pong", "<h1><em>pong!</em></h1>")
)