[MINOR] Add Version to bot command
This commit is contained in:
parent
d993436ed5
commit
1d8f5e77c7
5 changed files with 25 additions and 0 deletions
|
@ -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.
|
- **!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.
|
- **!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.
|
- **!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.
|
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.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {md5} from "js-md5";
|
import {md5} from "js-md5";
|
||||||
import {JITSI_ADMIN_URL} from "./config.mjs";
|
import {JITSI_ADMIN_URL} from "./config.mjs";
|
||||||
|
import gitRepoInfo from 'git-repo-info';
|
||||||
|
|
||||||
export class conferenceUtils {
|
export class conferenceUtils {
|
||||||
client;
|
client;
|
||||||
|
@ -62,5 +63,12 @@ export class conferenceUtils {
|
||||||
}
|
}
|
||||||
return roomDescription;
|
return roomDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getVersion(roomId) {
|
||||||
|
const repoInfo = gitRepoInfo();
|
||||||
|
|
||||||
|
this.client.sendText(roomId, 'Version: '+repoInfo.tag);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,20 @@ async function handleCommand(roomId, event) {
|
||||||
|
|
||||||
// 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'];
|
const body = event['content']['body'];
|
||||||
|
|
||||||
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("!version")){
|
||||||
|
conferenceUtil.getVersion(roomId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
9
package-lock.json
generated
9
package-lock.json
generated
|
@ -9,6 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"git-repo-info": "^2.1.1",
|
||||||
"js-md5": "^0.8.3",
|
"js-md5": "^0.8.3",
|
||||||
"matrix-bot-sdk": "^0.7.0"
|
"matrix-bot-sdk": "^0.7.0"
|
||||||
},
|
},
|
||||||
|
@ -745,6 +746,14 @@
|
||||||
"assert-plus": "^1.0.0"
|
"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": {
|
"node_modules/glob-to-regexp": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"git-repo-info": "^2.1.1",
|
||||||
"js-md5": "^0.8.3",
|
"js-md5": "^0.8.3",
|
||||||
"matrix-bot-sdk": "^0.7.0"
|
"matrix-bot-sdk": "^0.7.0"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue