Skip to content

Commit

Permalink
Merge pull request #7 from H2-invent/development
Browse files Browse the repository at this point in the history
[MAJOR]
  • Loading branch information
holema authored Dec 4, 2023
2 parents 39b5326 + 00708e4 commit 9de4965
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
15 changes: 15 additions & 0 deletions confernceUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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> ');
}

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) {
var roomDescription = await this.getRoomTopic(roomId)

Expand All @@ -51,6 +57,7 @@ export class conferenceUtils {
roomId,
'Neue Konferenz erstellen: !jitsi\n\r' +
'Direkt der Konferenz beitreten: !join\n\r' +
'Konferenz für alle starten: !starten\n\r'+
'Diese Hilfeseite anzeigen: !hilfe\n\r'
);
}
Expand All @@ -69,6 +76,14 @@ export class conferenceUtils {

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);


}
}

10 changes: 9 additions & 1 deletion index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ AutojoinRoomsMixin.setupOnClient(client);

// Before we start the bot, register our command handler
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.
client.start().then(() => console.log("Bot started!"));
client.setDisplayName(MATRIX_DISPLAYNAME)

const conferenceUtil = new conferenceUtils(client);
// This is the command handler we registered a few lines up
async function handleCommand(roomId, event) {
Expand All @@ -54,7 +55,14 @@ async function handleCommand(roomId, event) {
if (body?.startsWith("!hilfe")){
conferenceUtil.sendHelp(roomId)
}
if (body?.startsWith("!starten")){
conferenceUtil.inviteAll(roomId)
}
if (body?.startsWith("!version")){
conferenceUtil.getVersion(roomId)
}
}

async function handlemembership(roomId, event) {
conferenceUtil.sendWelcome(roomId)
}

0 comments on commit 9de4965

Please sign in to comment.