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

@ -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);