add warning that the bot is a MIM
This commit is contained in:
parent
bf7302dd59
commit
365340e6fb
2 changed files with 27 additions and 14 deletions
|
@ -77,18 +77,22 @@ export class conferenceUtils {
|
||||||
this.client.sendText(roomId, 'Version: '+BOT_VERSION);
|
this.client.sendText(roomId, 'Version: '+BOT_VERSION);
|
||||||
}
|
}
|
||||||
async sendWelcome(roomId) {
|
async sendWelcome(roomId) {
|
||||||
var text= 'Vielen Dank für die Einladung in diesen Raum.\n\r';
|
var text= '<h2>Hallo, ich bin der Raumassistent.</h2><br> Ein Teammitglied hat mich in diesen Raum eingeladen.<br><br>';
|
||||||
|
|
||||||
if (SHOW_WARNING_OF_MIM){
|
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 <b>alle Nachrichten</b> in diesem Chat mitlesen. Nicht nur Nachrichten an mich.<br>'
|
||||||
}
|
}
|
||||||
|
|
||||||
text +='✍️ Sie können mit mir chatten wie mit einem normalen Teilnehmenden.\n\r' +
|
text +='<b>Hier sind einige Dinge, die ich tun kann:</b>' +
|
||||||
'✅ Um auf alle meine Funktionen zugreifen zu können machen Sie mich bitte zu einem MODERATOR.\n\r' +
|
'<ul>'+
|
||||||
'❓️ Alle weiteren Informationen erhalten sie durch tippen von "!hilfe"';
|
'<li>📹️ Ich kann Videokonfernzen in diesem Raumn erstellen und verwalten</li>'
|
||||||
|
'<li>✍️ Sie können mit mir chatten wie mit einem normalen Teilnehmenden.</li>' +
|
||||||
|
'<li>✅ Um auf alle meine Funktionen zugreifen zu können machen Sie mich bitte zu einem MODERATOR.</li>' +
|
||||||
|
'<li>❓️ Alle weiteren Informationen erhalten sie durch tippen von "!hilfe"</li>'
|
||||||
|
+'</ul>';
|
||||||
|
|
||||||
|
|
||||||
this.client.sendText(roomId, text);
|
this.client.sendHtmlText(roomId, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
index.mjs
25
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 {MATRIX_DISPLAYNAME, MATRIX_TOKEN, MATRIX_URL} from './config.mjs'
|
||||||
import {conferenceUtils} from './confernceUtils.mjs'
|
import {conferenceUtils} from './confernceUtils.mjs'
|
||||||
|
|
||||||
const cryptoProvider = new RustSdkCryptoStorageProvider("./crypto-storage/");
|
const cryptoProvider = new RustSdkCryptoStorageProvider("./crypto-storage/");
|
||||||
|
|
||||||
// LogService.muteModule("Metrics");
|
// LogService.muteModule("Metrics");
|
||||||
|
@ -41,6 +49,7 @@ client.getWhoAmI().then(userInfo => {
|
||||||
console.error("Error verifying session:", err);
|
console.error("Error verifying session:", err);
|
||||||
});
|
});
|
||||||
const conferenceUtil = new conferenceUtils(client);
|
const conferenceUtil = new conferenceUtils(client);
|
||||||
|
|
||||||
// This is the command handler we registered a few lines up
|
// This is the command handler we registered a few lines up
|
||||||
async function handleCommand(roomId, event) {
|
async function handleCommand(roomId, event) {
|
||||||
// Don't handle unhelpful events (ones that aren't text messages, are redacted, or sent by us)
|
// 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;
|
if (event['sender'] === await client.getUserId()) return;
|
||||||
|
|
||||||
// Check to ensure that the `!hello` command is being run
|
// Check to ensure that the `!hello` command is being run
|
||||||
const body = event['content']['body'];
|
let body = event['content']['body'];
|
||||||
|
body = body.toLowerCase();
|
||||||
if (body?.startsWith("!jitsi")){
|
if (body?.startsWith("!jitsi")) {
|
||||||
await conferenceUtil.sendMessageWithUrl(roomId);
|
await conferenceUtil.sendMessageWithUrl(roomId);
|
||||||
await conferenceUtil.changeRoomName(roomId);
|
await conferenceUtil.changeRoomName(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body?.startsWith("!join")){
|
if (body?.startsWith("!join")) {
|
||||||
await conferenceUtil.sendJoinConference(roomId);
|
await conferenceUtil.sendJoinConference(roomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body?.startsWith("!hilfe")){
|
if (body?.startsWith("!hilfe")) {
|
||||||
conferenceUtil.sendHelp(roomId)
|
conferenceUtil.sendHelp(roomId)
|
||||||
}
|
}
|
||||||
if (body?.startsWith("!starten")){
|
if (body?.startsWith("!starten")) {
|
||||||
conferenceUtil.inviteAll(roomId)
|
conferenceUtil.inviteAll(roomId)
|
||||||
}
|
}
|
||||||
if (body?.startsWith("!version")){
|
if (body?.startsWith("!version")) {
|
||||||
conferenceUtil.getVersion(roomId)
|
conferenceUtil.getVersion(roomId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue