generated from array-in-a-matrix/matrix-bot-template
basic example of a ping bot
This commit is contained in:
parent
74d70123ec
commit
9f80848179
1 changed files with 15 additions and 0 deletions
15
examples/echo.nim
Normal file
15
examples/echo.nim
Normal 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>")
|
||||||
|
)
|
Loading…
Add table
Reference in a new issue