added bolier plate code

This commit is contained in:
array-in-a-matrix 2022-08-15 17:28:08 -04:00
parent 13cb7a463e
commit a7a32a23c5

View file

@ -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
})