Update ai information
This commit is contained in:
parent
7f079eb43b
commit
e46c4427cc
7 changed files with 31 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aslobot-matrix",
|
"name": "aslobot-matrix",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { ICallbackStore } from "../types.js";
|
||||||
import { config } from "../../config.js";
|
import { config } from "../../config.js";
|
||||||
import { getTextGemini, getImageGemini } from "../../services/ai/ai.js";
|
import { getTextGemini, getImageGemini } from "../../services/ai/ai.js";
|
||||||
import { alts } from "./alts.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 { getUserById, getUserName } from "../../helpers.js";
|
||||||
import { prices } from "./prices.js";
|
import { prices } from "./prices.js";
|
||||||
|
|
||||||
|
|
@ -38,7 +38,11 @@ const onAI = async (text: string, roomId: string, sender: string) => {
|
||||||
let instructions = {
|
let instructions = {
|
||||||
prefferedLanguages: ["english", "slovak"],
|
prefferedLanguages: ["english", "slovak"],
|
||||||
adminText: config.app.ai.prompt,
|
adminText: config.app.ai.prompt,
|
||||||
alts: alts,
|
alts: alts.map((alt) => ({
|
||||||
|
keys: alt.keys,
|
||||||
|
alt: alt.alt,
|
||||||
|
information: user.information,
|
||||||
|
})),
|
||||||
} as IAdminInstructions;
|
} as IAdminInstructions;
|
||||||
|
|
||||||
const username = getUserName(user);
|
const username = getUserName(user);
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,14 @@ const alts: IAIAlt[] = [
|
||||||
"macag",
|
"macag",
|
||||||
],
|
],
|
||||||
alt: "black cat",
|
alt: "black cat",
|
||||||
information: "an evil cat, married to white cat",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["macica", "macico"],
|
keys: ["macica", "macico"],
|
||||||
alt: "white cat",
|
alt: "white cat",
|
||||||
information: "married to black cat",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["gabor", "gaber", "martin", "marting"],
|
keys: ["gabor", "gaber", "martin", "marting"],
|
||||||
alt: "hedgehog",
|
alt: "hedgehog",
|
||||||
information: "married to ai",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: [
|
keys: [
|
||||||
|
|
@ -40,17 +37,14 @@ const alts: IAIAlt[] = [
|
||||||
"madek",
|
"madek",
|
||||||
],
|
],
|
||||||
alt: "beaver",
|
alt: "beaver",
|
||||||
information: "likes shoot fetish",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["janys", "jano", "janeg", "janek", "aslanek", "aslan", "aslo"],
|
keys: ["janys", "jano", "janeg", "janek", "aslanek", "aslan", "aslo"],
|
||||||
alt: "lion",
|
alt: "lion",
|
||||||
information: "the creator",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["marek", "mareg", "macek", "maceg", "rod"],
|
keys: ["marek", "mareg", "macek", "maceg", "rod"],
|
||||||
alt: "purple snake",
|
alt: "purple snake",
|
||||||
information: "drives fast",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["lara", "kostur", "kosturik"],
|
keys: ["lara", "kostur", "kosturik"],
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
interface IAIAlt {
|
interface IAIAlt {
|
||||||
keys: string[];
|
keys: string[];
|
||||||
alt: string;
|
alt: string;
|
||||||
information?: string;
|
information?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAdminInstructions {
|
interface IAdminInstructions {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ const onHelp = (_text: string, roomId: string) => {
|
||||||
<li><b>!say {text}</b> - Repeats your message</li>
|
<li><b>!say {text}</b> - Repeats your message</li>
|
||||||
<li><b>!bowling {text}</b> - Repeats your message in bowling</li>
|
<li><b>!bowling {text}</b> - Repeats your message in bowling</li>
|
||||||
<li><b>!help</b> - Prints this help message</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>!leaderboard</b> - Prints total user ranking</li>
|
||||||
<li><b>!aileaderboard</b> - Prints total user ai cost</li>
|
<li><b>!aileaderboard</b> - Prints total user ai cost</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ const registerModuleUser = (
|
||||||
startConditions: [`${config.app.triggerPrefix}me`],
|
startConditions: [`${config.app.triggerPrefix}me`],
|
||||||
callbackFunc: onMe,
|
callbackFunc: onMe,
|
||||||
});
|
});
|
||||||
|
callbackStore.messageCallbacks.push({
|
||||||
|
startConditions: [`${config.app.triggerPrefix}myinfo `],
|
||||||
|
callbackFunc: onMyInfo,
|
||||||
|
});
|
||||||
callbackStore.messageCallbacks.push({
|
callbackStore.messageCallbacks.push({
|
||||||
startConditions: [`${config.app.triggerPrefix}leaderboard`],
|
startConditions: [`${config.app.triggerPrefix}leaderboard`],
|
||||||
callbackFunc: onLeaderboard,
|
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 onLeaderboard = (_text: string, roomId: string) => {
|
||||||
const mapUsersToLeaderboard = (user: IUser): string => {
|
const mapUsersToLeaderboard = (user: IUser): string => {
|
||||||
const level = getLevel(user.experience);
|
const level = getLevel(user.experience);
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ interface IState {
|
||||||
|
|
||||||
interface IUser {
|
interface IUser {
|
||||||
id: string;
|
id: string;
|
||||||
|
information?: string;
|
||||||
role: TRole;
|
role: TRole;
|
||||||
experience: number;
|
experience: number;
|
||||||
money: number;
|
money: number;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue