added bolier plate code
This commit is contained in:
parent
13cb7a463e
commit
a7a32a23c5
1 changed files with 13 additions and 0 deletions
13
index.js
13
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
|
||||||
|
})
|
Loading…
Add table
Reference in a new issue