Update ai information

This commit is contained in:
Aslan 2025-12-28 19:11:32 +01:00
parent 7f079eb43b
commit e46c4427cc
7 changed files with 31 additions and 11 deletions

View file

@ -1,6 +1,6 @@
{
"name": "aslobot-matrix",
"version": "0.7.1",
"version": "0.7.2",
"description": "",
"license": "ISC",
"author": "",

View file

@ -3,7 +3,7 @@ import type { ICallbackStore } from "../types.js";
import { config } from "../../config.js";
import { getTextGemini, getImageGemini } from "../../services/ai/ai.js";
import { alts } from "./alts.js";
import type { IAdminInstructions } from "./types.js";
import type { IAdminInstructions, IAIAlt } from "./types.js";
import { getUserById, getUserName } from "../../helpers.js";
import { prices } from "./prices.js";
@ -38,7 +38,11 @@ const onAI = async (text: string, roomId: string, sender: string) => {
let instructions = {
prefferedLanguages: ["english", "slovak"],
adminText: config.app.ai.prompt,
alts: alts,
alts: alts.map((alt) => ({
keys: alt.keys,
alt: alt.alt,
information: user.information,
})),
} as IAdminInstructions;
const username = getUserName(user);

View file

@ -16,17 +16,14 @@ const alts: IAIAlt[] = [
"macag",
],
alt: "black cat",
information: "an evil cat, married to white cat",
},
{
keys: ["macica", "macico"],
alt: "white cat",
information: "married to black cat",
},
{
keys: ["gabor", "gaber", "martin", "marting"],
alt: "hedgehog",
information: "married to ai",
},
{
keys: [
@ -40,17 +37,14 @@ const alts: IAIAlt[] = [
"madek",
],
alt: "beaver",
information: "likes shoot fetish",
},
{
keys: ["janys", "jano", "janeg", "janek", "aslanek", "aslan", "aslo"],
alt: "lion",
information: "the creator",
},
{
keys: ["marek", "mareg", "macek", "maceg", "rod"],
alt: "purple snake",
information: "drives fast",
},
{
keys: ["lara", "kostur", "kosturik"],

View file

@ -1,7 +1,7 @@
interface IAIAlt {
keys: string[];
alt: string;
information?: string;
information?: string | undefined;
}
interface IAdminInstructions {

View file

@ -68,7 +68,8 @@ const onHelp = (_text: string, roomId: string) => {
<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>!me / !me {mention}</b> - Prints your role, level, experience, money and ai cost</li>
<li><b>!me / !me {mention}</b> - Prints data about you</li>
<li><b>!myinfo {newinfo}</b> - Updates your description</li>
<li><b>!leaderboard</b> - Prints total user ranking</li>
<li><b>!aileaderboard</b> - Prints total user ai cost</li>
</ul>

View file

@ -21,6 +21,10 @@ const registerModuleUser = (
startConditions: [`${config.app.triggerPrefix}me`],
callbackFunc: onMe,
});
callbackStore.messageCallbacks.push({
startConditions: [`${config.app.triggerPrefix}myinfo `],
callbackFunc: onMyInfo,
});
callbackStore.messageCallbacks.push({
startConditions: [`${config.app.triggerPrefix}leaderboard`],
callbackFunc: onLeaderboard,
@ -51,6 +55,22 @@ const onMe = (text: string, roomId: string, sender: string) => {
);
};
const onMyInfo = (text: string, roomId: string, sender: string) => {
const user = getUserById(sender);
const newInformation = text.replace(
`${config.app.triggerPrefix}myinfo `,
"",
);
if (!user || newInformation.length < 3) {
return;
}
user.information = newInformation;
client.sendTextMessage(roomId, "Information updated");
};
const onLeaderboard = (_text: string, roomId: string) => {
const mapUsersToLeaderboard = (user: IUser): string => {
const level = getLevel(user.experience);

View file

@ -4,6 +4,7 @@ interface IState {
interface IUser {
id: string;
information?: string;
role: TRole;
experience: number;
money: number;