32baaebb93
Add ability to see, change and list gemini, mistral and ollama models
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
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 extends ChatCommand {
|
|
argsMode = "required" as const;
|
|
|
|
title = "/ae";
|
|
description = "evaluation";
|
|
|
|
requirements = Requirements.Build(Requirement.BOT_CREATOR);
|
|
|
|
async execute(msg: Message, params?: RegExpExecArray) {
|
|
const match = params?.[3];
|
|
|
|
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);
|
|
}
|
|
}
|
|
} |