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
+24
View File
@@ -0,0 +1,24 @@
import {ChatCommand} from "../base/chat-command";
import {getRandomInt, getRangedRandomInt, logError, oldSendMessage} from "../util/utils";
import {Message} from "typescript-telegram-bot-api";
export class RandomInt extends ChatCommand {
regexp = /^\/randomInt/i;
title = "/randomInt [min] [max]";
description = "Ranged random integer from parameters";
async execute(msg: Message) {
const split = msg.text.split(" ");
const min = parseInt(split[1]);
const max = parseInt(split[2]);
const good = max > min;
const sufficient = !!(min && max) && good;
const random = !sufficient ? getRandomInt(Math.pow(2, 60)) : getRangedRandomInt(min, max);
const randomText = !sufficient ? random.toString() : `[${min}; ${max}]: ${random}`;
await oldSendMessage(msg, randomText).catch(logError);
}
}