shitton of the ai changes

This commit is contained in:
2026-05-01 04:54:11 +03:00
parent d95c37a322
commit 8cff086a8e
194 changed files with 29409 additions and 8841 deletions
+22 -19
View File
@@ -2,47 +2,50 @@ import {Command} from "../base/command";
import {Message} from "typescript-telegram-bot-api";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {bot} from "../index";
import {bot, shutdown as shutdownApp} from "../index";
import {delay, logError, randomValue} from "../util/utils";
const texts = [
"ну что-же, господа",
"приятно было с вами пообщаться",
"но мне пора на покой",
"всего хорошего"
];
import {enqueueTelegramApiCall} from "../util/telegram-api-queue";
import {Environment} from "../common/environment";
const timings = [1500, 2500];
const timer = [3, 2, 1];
export class Shutdown extends Command {
title = "/shutdown";
description = "Self-destruction sequence for bot (shutdown)";
title = Environment.commandTitles.shutdown;
description = Environment.commandDescriptions.shutdown;
argsMode = "optional" as const;
requirements = Requirements.Build(Requirement.BOT_CREATOR);
async execute(msg: Message, match?: RegExpExecArray): Promise<void> {
await bot.sendMessage({chat_id: msg.chat.id, text: "..."}).catch(logError);
const send = async (text: string) => {
await enqueueTelegramApiCall(
() => bot.sendMessage({chat_id: msg.chat.id, text}),
{method: "sendMessage", chatId: msg.chat.id, chatType: msg.chat.type}
).catch(logError);
};
await send(Environment.shutdownFallbackText);
const now = match?.[3]?.toLowerCase() === "now";
if (msg.chat.type !== "private" && !now) {
for (const text of texts) {
await delay(randomValue(timings));
await bot.sendMessage({chat_id: msg.chat.id, text: text}).catch(logError);
for (const text of Environment.shutdownSequenceTexts) {
await delay(randomValue(timings) ?? 1500);
await send(text);
}
await delay(randomValue(timings));
await delay(randomValue(timings) ?? 1500);
for (const t of timer) {
await bot.sendMessage({chat_id: msg.chat.id, text: `${t}`}).catch(logError);
await send(`${t}`);
await delay(1000);
}
}
await bot.sendMessage({chat_id: msg.chat.id, text: "*R.I.P*"}).catch(logError);
await send(Environment.shutdownDoneText);
delay(2000).then(() => process.exit(0));
await delay(2000);
await shutdownApp("manual");
}
}
}