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
+46
View File
@@ -0,0 +1,46 @@
import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {bot} from "../index";
import {delay, logError, randomValue} from "../util/utils";
const texts = [
"ну что-же, господа",
"приятно было с вами пообщаться",
"но мне пора на покой",
"всего хорошего"
];
const timings = [1500, 2500];
const timer = [3, 2, 1];
export class Shutdown extends ChatCommand {
regexp = /^\/shutdown/i;
title = "/shutdown";
description = "Self-destruction sequence for bot (shutdown)";
requirements = Requirements.Build(Requirement.BOT_CREATOR);
async execute(msg: Message): Promise<void> {
await bot.sendMessage({chat_id: msg.chat.id, text: "..."}).catch(logError);
if (msg.chat.type !== "private" && !msg.text.toLowerCase().startsWith("/shutdown now")) {
for (const text of texts) {
await delay(randomValue(timings));
await bot.sendMessage({chat_id: msg.chat.id, text: text}).catch(logError);
}
await delay(randomValue(timings));
for (const t of timer) {
await bot.sendMessage({chat_id: msg.chat.id, text: `${t}`}).catch(logError);
await delay(1000);
}
}
await bot.sendMessage({chat_id: msg.chat.id, text: "*R.I.P*"}).catch(logError);
delay(2000).then(() => process.exit(0));
}
}