diff --git a/RELEASE_NOTE.md b/RELEASE_NOTE.md index 786b58e..a249f3c 100644 --- a/RELEASE_NOTE.md +++ b/RELEASE_NOTE.md @@ -11,6 +11,7 @@ Welcome to the inaugural release of our Matrix bot equipped with conference crea - **!hilfe Command:** Use `!hilfe` to display a comprehensive list of available commands, providing users with quick access to the bot's functionalities. - **!jitsi Command:** Use `!jitsi` to Instantly initiate a new room in Jitsi if no room is specified in the current room description. This command streamlines the creation of conference rooms. - **!join Command:** Use `!join` to Generate a direct link enabling users to swiftly join ongoing conferences without hassle. +- **!version Command:** Use `!version` to Generate a string with the version of the Bot. We're thrilled to launch this initial version of the Matrix bot, aiming to enhance user experience by simplifying conference creation and access within Matrix chat. diff --git a/confernceUtils.mjs b/confernceUtils.mjs index 7380153..3c381a0 100644 --- a/confernceUtils.mjs +++ b/confernceUtils.mjs @@ -1,5 +1,6 @@ import {md5} from "js-md5"; import {JITSI_ADMIN_URL} from "./config.mjs"; +import gitRepoInfo from 'git-repo-info'; export class conferenceUtils { client; @@ -62,5 +63,12 @@ export class conferenceUtils { } return roomDescription; } + + async getVersion(roomId) { + const repoInfo = gitRepoInfo(); + + this.client.sendText(roomId, 'Version: '+repoInfo.tag); + } + } diff --git a/index.mjs b/index.mjs index 43b1ddb..59d3c30 100644 --- a/index.mjs +++ b/index.mjs @@ -41,14 +41,20 @@ async function handleCommand(roomId, event) { // Check to ensure that the `!hello` command is being run const body = event['content']['body']; + if (body?.startsWith("!jitsi")){ await conferenceUtil.sendMessageWithUrl(roomId); await conferenceUtil.changeRoomName(roomId); } + if (body?.startsWith("!join")){ await conferenceUtil.sendJoinConference(roomId); } + if (body?.startsWith("!hilfe")){ conferenceUtil.sendHelp(roomId) } + if (body?.startsWith("!version")){ + conferenceUtil.getVersion(roomId) + } } diff --git a/package-lock.json b/package-lock.json index 33d5f8c..c95ac40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "git-repo-info": "^2.1.1", "js-md5": "^0.8.3", "matrix-bot-sdk": "^0.7.0" }, @@ -745,6 +746,14 @@ "assert-plus": "^1.0.0" } }, + "node_modules/git-repo-info": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/git-repo-info/-/git-repo-info-2.1.1.tgz", + "integrity": "sha512-8aCohiDo4jwjOwma4FmYFd3i97urZulL8XL24nIPxuE+GZnfsAyy/g2Shqx6OjUiFKUXZM+Yy+KHnOmmA3FVcg==", + "engines": { + "node": ">= 4.0" + } + }, "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", diff --git a/package.json b/package.json index c72fafd..f4384e7 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "git-repo-info": "^2.1.1", "js-md5": "^0.8.3", "matrix-bot-sdk": "^0.7.0" },