diff --git a/confernceUtils.mjs b/confernceUtils.mjs index 8d61c33..b6f1c84 100644 --- a/confernceUtils.mjs +++ b/confernceUtils.mjs @@ -77,18 +77,22 @@ export class conferenceUtils { this.client.sendText(roomId, 'Version: '+BOT_VERSION); } async sendWelcome(roomId) { - var text= 'Vielen Dank für die Einladung in diesen Raum.\n\r'; + var text= '

Hallo, ich bin der Raumassistent.


Ein Teammitglied hat mich in diesen Raum eingeladen.

'; if (SHOW_WARNING_OF_MIM){ - text += '⚠️ Der Bot kann alle Nachrichten lesen und die Nachrichten sind durch den Bot-Admin lesbar\n\r' + text += '⚠️ Kleiner Disclaimer zu Beginn: Ich kann alle Nachrichten in diesem Chat mitlesen. Nicht nur Nachrichten an mich.
' } - text +='✍️ Sie können mit mir chatten wie mit einem normalen Teilnehmenden.\n\r' + - '✅ Um auf alle meine Funktionen zugreifen zu können machen Sie mich bitte zu einem MODERATOR.\n\r' + - '❓️ Alle weiteren Informationen erhalten sie durch tippen von "!hilfe"'; + text +='Hier sind einige Dinge, die ich tun kann:' + + ''; - this.client.sendText(roomId, text); + this.client.sendHtmlText(roomId, text); } } diff --git a/index.mjs b/index.mjs index eae13eb..2e721f1 100644 --- a/index.mjs +++ b/index.mjs @@ -1,7 +1,15 @@ -import {AutojoinRoomsMixin, MatrixClient, RustSdkCryptoStorageProvider, SimpleFsStorageProvider, LogService, LogLevel} from "matrix-bot-sdk"; +import { + AutojoinRoomsMixin, + MatrixClient, + RustSdkCryptoStorageProvider, + SimpleFsStorageProvider, + LogService, + LogLevel +} from "matrix-bot-sdk"; import {MATRIX_DISPLAYNAME, MATRIX_TOKEN, MATRIX_URL} from './config.mjs' import {conferenceUtils} from './confernceUtils.mjs' + const cryptoProvider = new RustSdkCryptoStorageProvider("./crypto-storage/"); // LogService.muteModule("Metrics"); @@ -41,6 +49,7 @@ client.getWhoAmI().then(userInfo => { console.error("Error verifying session:", err); }); const conferenceUtil = new conferenceUtils(client); + // 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) @@ -48,24 +57,24 @@ async function handleCommand(roomId, event) { if (event['sender'] === await client.getUserId()) return; // Check to ensure that the `!hello` command is being run - const body = event['content']['body']; - - if (body?.startsWith("!jitsi")){ + let body = event['content']['body']; + body = body.toLowerCase(); + if (body?.startsWith("!jitsi")) { await conferenceUtil.sendMessageWithUrl(roomId); await conferenceUtil.changeRoomName(roomId); } - if (body?.startsWith("!join")){ + if (body?.startsWith("!join")) { await conferenceUtil.sendJoinConference(roomId); } - if (body?.startsWith("!hilfe")){ + if (body?.startsWith("!hilfe")) { conferenceUtil.sendHelp(roomId) } - if (body?.startsWith("!starten")){ + if (body?.startsWith("!starten")) { conferenceUtil.inviteAll(roomId) } - if (body?.startsWith("!version")){ + if (body?.startsWith("!version")) { conferenceUtil.getVersion(roomId) } }