Add info; Version 0.5.0
This commit is contained in:
parent
dd4da06753
commit
4819805b3c
4 changed files with 19 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import config from "./config.json" with { type: "json" };
|
||||
import packageConfig from "../package.json" with { type: "json" };
|
||||
|
||||
export { config };
|
||||
export { config, packageConfig };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { MatrixClient } from "matrix-js-sdk";
|
||||
import type { ICallbackStore } from "../types.js";
|
||||
import { config } from "../../config.js";
|
||||
import { config, packageConfig } from "../../config.js";
|
||||
import { platform } from "os";
|
||||
|
||||
let client: MatrixClient;
|
||||
|
||||
|
|
@ -14,6 +15,10 @@ const registerModuleBase = (
|
|||
startConditions: [`${config.app.triggerPrefix}ping`],
|
||||
callbackFunc: onPing,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [`${config.app.triggerPrefix}info`],
|
||||
callbackFunc: onInfo,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [`${config.app.triggerPrefix}say `],
|
||||
callbackFunc: onSay,
|
||||
|
|
@ -32,6 +37,14 @@ const onPing = (_text: string, roomId: string) => {
|
|||
client.sendTextMessage(roomId, "Pong!");
|
||||
};
|
||||
|
||||
const onInfo = (_text: string, roomId: string) => {
|
||||
client.sendHtmlMessage(
|
||||
roomId,
|
||||
"",
|
||||
`<p>AsloBot version <b>${packageConfig.version}</b> running on <b>${platform()}</b></p>`,
|
||||
);
|
||||
};
|
||||
|
||||
const onSay = (text: string, roomId: string) => {
|
||||
const trigger = `${config.app.triggerPrefix}say `;
|
||||
|
||||
|
|
@ -51,6 +64,7 @@ const onHelp = (_text: string, roomId: string) => {
|
|||
`<h3>Role: User</h3>
|
||||
<ul>
|
||||
<li><b>!ping</b> - Pong!</li>
|
||||
<li><b>!info</b> - Prints information about this bot</li>
|
||||
<li><b>!say {text}</b> - Repeats your message</li>
|
||||
<li><b>!bowling {text}</b> - Repeats your message in bowling</li>
|
||||
<li><b>!help</b> - Prints this help message</li>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const onLevel = (_text: string, roomId: string, sender: string) => {
|
|||
client.sendHtmlMessage(
|
||||
roomId,
|
||||
"",
|
||||
`<h3>Your Level: <b>${level.level}</b></h3>
|
||||
`<h3>Your Level: ${level.level}</h3>
|
||||
</br>
|
||||
<i>Next level progress: ${level.experienceInLevel}/${level.expToNextLevel}xp</i>`,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue