Files
tg-chat-bot/src/commands/unignore.ts
T
melod1n b74e0a0f3e refactor(bot): centralize runtime state; support albums + safer vision handling
- make MessageStore.put() return StoredMessage and allow collectReplyChainText() to work with StoredMessage
- move muted users + answers loading into Environment (add Answers model + GEMINI_IMAGE_MODEL)
- extract message handling into processNewMessage() and add media-group (album) caching/downloading by unique_file_id
- for Ollama: check model capabilities before sending images; use replyToMessage helper consistently
- add /geminiGenImage command stub for Gemini image generation
2026-01-29 20:01:30 +03:00

42 lines
1.5 KiB
TypeScript

import {ChatCommand} from "../base/chat-command";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {fullName, logError, oldSendMessage} from "../util/utils";
import {Message} from "typescript-telegram-bot-api";
import {botUser} from "../index";
import {Environment} from "../common/environment";
export class Unignore extends ChatCommand {
title = "/unignore";
description = "Bot will start responding to the user";
requirements = Requirements.Build(
Requirement.BOT_ADMIN,
Requirement.CHAT,
Requirement.CHAT_ADMIN,
Requirement.BOT_CHAT_ADMIN,
Requirement.REPLY,
);
async execute(msg: Message) {
if (!msg.reply_to_message) return;
const id = msg.reply_to_message.from.id;
const text = fullName(msg.reply_to_message.from);
if (id === botUser.id) {
await oldSendMessage(msg, "Бот и так всегда к себе прислушивается").catch(logError);
return;
}
if (id === Environment.CREATOR_ID) {
await oldSendMessage(msg, "Бот всегда слушает своего создателя").catch(logError);
return;
}
if (await Environment.removeMute(id)) {
await oldSendMessage(msg, text + " больше не в муте! 🔈").catch(logError);
} else {
await oldSendMessage(msg, text + " не был в муте 🤔").catch(logError);
}
}
}