* Add greeting funcionaltity
* Add start meeting for @all
This commit is contained in:
Entwicklung 2023-12-04 14:14:08 +01:00
parent b612c1bbda
commit 00708e4f8b
2 changed files with 24 additions and 1 deletions

View file

@ -32,6 +32,12 @@ export class conferenceUtils {
await this.client.sendHtmlText(roomId, '<div role="button" tabindex="0" class="mx_AccessibleButton mx_MemberList_invite"><a href ="' + url + '">Hier der Konferenz beitreten</a></div> '); await this.client.sendHtmlText(roomId, '<div role="button" tabindex="0" class="mx_AccessibleButton mx_MemberList_invite"><a href ="' + url + '">Hier der Konferenz beitreten</a></div> ');
} }
async inviteAll(roomId) {
var url = await this.createConference(roomId);
var text = '@room <h1>Diese Konferenz startet gerade</h1><br><a href="'+url+'">Jetzt dieser Konfernz beitreten</a>'
await this.client.sendHtmlText(roomId, text);
}
async changeRoomName(roomId) { async changeRoomName(roomId) {
var roomDescription = await this.getRoomTopic(roomId) var roomDescription = await this.getRoomTopic(roomId)
@ -51,6 +57,7 @@ export class conferenceUtils {
roomId, roomId,
'Neue Konferenz erstellen: !jitsi\n\r' + 'Neue Konferenz erstellen: !jitsi\n\r' +
'Direkt der Konferenz beitreten: !join\n\r' + 'Direkt der Konferenz beitreten: !join\n\r' +
'Konferenz für alle starten: !starten\n\r'+
'Diese Hilfeseite anzeigen: !hilfe\n\r' 'Diese Hilfeseite anzeigen: !hilfe\n\r'
); );
} }
@ -69,6 +76,14 @@ export class conferenceUtils {
this.client.sendText(roomId, 'Version: '+BOT_VERSION); this.client.sendText(roomId, 'Version: '+BOT_VERSION);
} }
async sendWelcome(roomId) {
const text = 'Vielen Dank für die Einladung in diesen Raum.\n\r' +
' 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"';
this.client.sendText(roomId, text);
}
} }

View file

@ -28,10 +28,11 @@ AutojoinRoomsMixin.setupOnClient(client);
// Before we start the bot, register our command handler // Before we start the bot, register our command handler
client.on("room.message", handleCommand); client.on("room.message", handleCommand);
client.on("room.join", handlemembership);
// Now that everything is set up, start the bot. This will start the sync loop and run until killed. // 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.start().then(() => console.log("Bot started!"));
client.setDisplayName(MATRIX_DISPLAYNAME) client.setDisplayName(MATRIX_DISPLAYNAME)
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) {
@ -54,7 +55,14 @@ async function handleCommand(roomId, event) {
if (body?.startsWith("!hilfe")){ if (body?.startsWith("!hilfe")){
conferenceUtil.sendHelp(roomId) conferenceUtil.sendHelp(roomId)
} }
if (body?.startsWith("!starten")){
conferenceUtil.inviteAll(roomId)
}
if (body?.startsWith("!version")){ if (body?.startsWith("!version")){
conferenceUtil.getVersion(roomId) conferenceUtil.getVersion(roomId)
} }
} }
async function handlemembership(roomId, event) {
conferenceUtil.sendWelcome(roomId)
}