Add ai functionality
This commit is contained in:
parent
da66cf9001
commit
dd4da06753
19 changed files with 1118 additions and 52 deletions
|
|
@ -4,22 +4,26 @@ import { config } from "../../config.js";
|
|||
|
||||
let client: MatrixClient;
|
||||
|
||||
const registerModuleTest = (
|
||||
const registerModuleBase = (
|
||||
matrixClient: MatrixClient,
|
||||
callbackStore: ICallbackStore,
|
||||
) => {
|
||||
client = matrixClient;
|
||||
|
||||
callbackStore.messageCallbacks.push({
|
||||
startCondition: `${config.app.triggerPrefix}ping`,
|
||||
startConditions: [`${config.app.triggerPrefix}ping`],
|
||||
callbackFunc: onPing,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startCondition: `${config.app.triggerPrefix}say `,
|
||||
startConditions: [`${config.app.triggerPrefix}say `],
|
||||
callbackFunc: onSay,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startCondition: `${config.app.triggerPrefix}help`,
|
||||
startConditions: [`${config.app.triggerPrefix}bowling `],
|
||||
callbackFunc: onBowling,
|
||||
});
|
||||
callbackStore.messageCallbacks.push({
|
||||
startConditions: [`${config.app.triggerPrefix}help`],
|
||||
callbackFunc: onHelp,
|
||||
});
|
||||
};
|
||||
|
|
@ -34,6 +38,12 @@ const onSay = (text: string, roomId: string) => {
|
|||
client.sendTextMessage(roomId, text.replace(trigger, ""));
|
||||
};
|
||||
|
||||
const onBowling = (text: string, _roomId: string) => {
|
||||
const trigger = `${config.app.triggerPrefix}bowling `;
|
||||
|
||||
client.sendTextMessage(config.app.bowlingRoomId, text.replace(trigger, ""));
|
||||
};
|
||||
|
||||
const onHelp = (_text: string, roomId: string) => {
|
||||
client.sendHtmlMessage(
|
||||
roomId,
|
||||
|
|
@ -42,9 +52,11 @@ const onHelp = (_text: string, roomId: string) => {
|
|||
<ul>
|
||||
<li><b>!ping</b> - Pong!</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>
|
||||
<li><b>!rank</b> - Prints your rank and experience</li>
|
||||
<li><b>!level</b> - Prints your level and experience</li>
|
||||
<li><b>!leaderboard</b> - Prints total user ranking</li>
|
||||
<li><b>!ai {text}</b> - Say something to Gemini 3</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
<h3>Role: Moderator</h3>
|
||||
|
|
@ -60,4 +72,4 @@ const onHelp = (_text: string, roomId: string) => {
|
|||
);
|
||||
};
|
||||
|
||||
export { registerModuleTest };
|
||||
export { registerModuleBase };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue