From a7a32a23c5c55bf7a20db3249a798a6f95fbe8ae Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Mon, 15 Aug 2022 17:28:08 -0400 Subject: [PATCH] added bolier plate code --- index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.js b/index.js index e69de29..f493225 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,13 @@ +import config from './config.json' assert {type: "json"}; +import { MatrixClient, SimpleFsStorageProvider, AutojoinRoomsMixin } from "matrix-bot-sdk"; + +const storage = new SimpleFsStorageProvider("storage.json"); +const client = new MatrixClient(config.baseUrl, config.token, storage); + +AutojoinRoomsMixin.setupOnClient(client) +client.start().then(() => console.log(`Client has started!`)); + +client.on("room.message", (roomId, event) => { + if (! event["content"] || event["sender"] === config.userId) return; + // code here +})