Removed, using typescript

This commit is contained in:
Chris Plaatjes 2023-02-22 18:00:11 -05:00
parent f89a5a5aa6
commit 976da7257b

View File

@ -1,26 +0,0 @@
const sdk = require("matrix-bot-sdk");
const MatrixClient = sdk.MatrixClient;
const SimpleFsStorageProvider = sdk.SimpleFsStorageProvider;
const AutojoinRoomsMixin = sdk.AutojoinRoomsMixin;
const homeserverUrl = "";
const accessToken = "";
const storage = new SimpleFsStorageProvider("config/bot.json");
const client = new MatrixClient(homeserverUrl, accessToken, storage);
AutojoinRoomsMixin.setupOnClient(client);
client.start().then(() => console.log("Client started!"));
client.on("room.message", (roomId, event) => {
if (! event["content"]) return;
const sender = event["sender"];
const body = event["content"]["body"];
console.log(`${roomId}: ${sender} says '${body}`);
});
client.sendMessage(roomId, {
"msgtype": "m.text",
"body": "This is message text.",
});