add readme

This commit is contained in:
Entwicklung 2023-11-27 23:40:20 +01:00
parent 2bc8d06ab6
commit a1c6c0765c
2 changed files with 4 additions and 3 deletions

View file

@ -2,4 +2,5 @@ export var MATRIX_TOKEN=process.env.MATRIX_TOKEN ||"sys_xxxx"
export var MATRIX_URL=process.env.MATRIX_URL || "https://matrix.org";
export var JITSI_ADMIN_URL =process.env.JITSI_ADMIN_URL || 'https://jitsi-admin.de';
export var MATRIX_USERNAME =process.env.MATRIX_USERNAME || 'h2inventbot';
export var MATRIX_PASSWORD =process.env.MATRIX_PASSWORD || 'xxxxxxxx';
export var MATRIX_PASSWORD =process.env.MATRIX_PASSWORD || 'xxxxxxxx';
export var MATRIX_DISPLAYNAME =process.env.MATRIX_DISPLAYNAME || 'Raumassistent';

View file

@ -1,7 +1,7 @@
import {AutojoinRoomsMixin, MatrixClient, RustSdkCryptoStorageProvider, SimpleFsStorageProvider} from "matrix-bot-sdk";
import {md5} from 'js-md5';
import {JITSI_ADMIN_URL, MATRIX_TOKEN, MATRIX_URL} from './config.mjs'
import {JITSI_ADMIN_URL, MATRIX_DISPLAYNAME, MATRIX_TOKEN, MATRIX_URL} from './config.mjs'
const cryptoProvider = new RustSdkCryptoStorageProvider("./crypto-storage/");
@ -32,7 +32,7 @@ client.on("room.message", handleCommand);
// Now that everything is set up, start the bot. This will start the sync loop and run until killed.
client.start().then(() => console.log("Bot started!"));
client.setDisplayName(MATRIX_DISPLAYNAME)
// This is the command handler we registered a few lines up
async function handleCommand(roomId, event) {
// Don't handle unhelpful events (ones that aren't text messages, are redacted, or sent by us)