Compare commits
No commits in common. "1a2ec10b041b640a2cfa22752c646be8d7a2da8cac121a43ccd26d9fde9a859a" and "59d54b37fb4a83d5bafa1f51c6905922b2caf809c9949d613cfd90e45b0614aa" have entirely different histories.
1a2ec10b04
...
59d54b37fb
8 changed files with 15 additions and 24 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aslobot-matrix",
|
"name": "aslobot-matrix",
|
||||||
"version": "0.7.1",
|
"version": "0.7.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@
|
||||||
"ai": {
|
"ai": {
|
||||||
"api": {
|
"api": {
|
||||||
"key": ""
|
"key": ""
|
||||||
},
|
}
|
||||||
"prompt": "Your name is Aslobot. Be concise, try to keep text as short as possible. Be helpful."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,7 @@ const getUserName = (user: IUser): string => {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
let username = match.replaceAll("@", "");
|
return match.replaceAll("@", "");
|
||||||
username = username.charAt(0).toUpperCase() + username.slice(1);
|
|
||||||
return username;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getUserFromMention = (mention: string | undefined): IUser | undefined => {
|
const getUserFromMention = (mention: string | undefined): IUser | undefined => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import type { ICallbackStore } from "../types.js";
|
||||||
import { config } from "../../config.js";
|
import { config } from "../../config.js";
|
||||||
import { load, save, state } from "../../store/store.js";
|
import { load, save, state } from "../../store/store.js";
|
||||||
import type { TRole } from "../../store/types.js";
|
import type { TRole } from "../../store/types.js";
|
||||||
import { getUserFromMention, getUserName } from "../../helpers.js";
|
import { getUserFromMention } from "../../helpers.js";
|
||||||
|
|
||||||
let client: MatrixClient;
|
let client: MatrixClient;
|
||||||
|
|
||||||
|
|
@ -46,12 +46,8 @@ const onSetRole = async (text: string, roomId: string) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
user.role = role;
|
user.role = role;
|
||||||
const username = getUserName(user);
|
|
||||||
|
|
||||||
client.sendTextMessage(
|
client.sendTextMessage(roomId, `Role for ${user} has been set to ${role}`);
|
||||||
roomId,
|
|
||||||
`Role for ${username} has been set to ${role}`,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onShutdown = async (text: string, roomId: string) => {
|
const onShutdown = async (text: string, roomId: string) => {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ const onAI = async (text: string, roomId: string, sender: string) => {
|
||||||
let textMod = text.replace("!ai", "").trim().toLowerCase();
|
let textMod = text.replace("!ai", "").trim().toLowerCase();
|
||||||
let instructions = {
|
let instructions = {
|
||||||
prefferedLanguages: ["english", "slovak"],
|
prefferedLanguages: ["english", "slovak"],
|
||||||
adminText: config.app.ai.prompt,
|
adminText:
|
||||||
|
"Your name is Aslobot. Be concise, try to keep text as short as possible. Be helpful, but you are encouraged to be sarcastic and make fun of people",
|
||||||
alts: alts,
|
alts: alts,
|
||||||
} as IAdminInstructions;
|
} as IAdminInstructions;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,6 @@
|
||||||
interface IAIAlt {
|
interface IAIAlt {
|
||||||
keys: string[];
|
keys: string[];
|
||||||
alt: string;
|
alt: string;
|
||||||
information?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAdminInstructions {
|
interface IAdminInstructions {
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,11 @@ const onMe = (text: string, roomId: string, sender: string) => {
|
||||||
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);
|
||||||
const username = getUserName(user);
|
const userName = getUserName(user);
|
||||||
|
const userNameMod =
|
||||||
|
userName.charAt(0).toUpperCase() + userName.slice(1);
|
||||||
|
|
||||||
return `<li>${username}: level <b>${level.level}</b> (${level.experienceInLevel}/${level.expToNextLevel}xp)</li>`;
|
return `<li>${userNameMod}: level <b>${level.level}</b> (${level.experienceInLevel}/${level.expToNextLevel}xp)</li>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const users = state.users.sort(
|
const users = state.users.sort(
|
||||||
|
|
@ -76,9 +78,11 @@ const onLeaderboard = (_text: string, roomId: string) => {
|
||||||
const onAILeaderboard = (_text: string, roomId: string) => {
|
const onAILeaderboard = (_text: string, roomId: string) => {
|
||||||
const mapUsersToLeaderboard = (user: IUser): string => {
|
const mapUsersToLeaderboard = (user: IUser): string => {
|
||||||
const cost = user.aiCost;
|
const cost = user.aiCost;
|
||||||
const username = getUserName(user);
|
const userName = getUserName(user);
|
||||||
|
const userNameMod =
|
||||||
|
userName.charAt(0).toUpperCase() + userName.slice(1);
|
||||||
|
|
||||||
return `<li>${username}: cost <b>${cost.toFixed(2)}$</b></li>`;
|
return `<li>${userNameMod}: cost <b>${cost}</b></li>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const users = state.users.sort(
|
const users = state.users.sort(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue