refactor!: rewrite bot core; add AI (Ollama, Gemini), DB, new commands

This commit is contained in:
2026-01-12 15:32:50 +03:00
parent 9d74ad9861
commit df9471a7e4
137 changed files with 11341 additions and 2025 deletions
+37
View File
@@ -0,0 +1,37 @@
import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {errorPlaceholder, logError, oldSendMessage} from "../util/utils";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
export class Ae implements ChatCommand {
regexp = /^\/ae\s([^]+)/i;
title = "/ae";
description = "evaluation";
requirements = Requirements.Build(Requirement.BOT_CREATOR);
async execute(msg: Message, params: string[]) {
const match = params[1];
try {
let e = eval(match);
e = ((typeof e == "string") ? e : JSON.stringify(e));
await oldSendMessage(msg, e).catch(async () => await errorPlaceholder(msg));
} catch (e) {
const text = e.message.toString();
if (text.includes("is not defined")) {
await oldSendMessage(msg, "variable is not defined").catch(logError);
return;
}
console.error(`${text}
* Stacktrace: ${e.stack}`);
await oldSendMessage(msg, text).catch(logError);
}
}
}