This commit is contained in:
2026-01-12 16:44:21 +03:00
parent c6faa19cb0
commit 8fe6857345
5 changed files with 51 additions and 58 deletions
-18
View File
@@ -1,18 +0,0 @@
import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {MessageStore} from "../common/message-store";
import {logError, sendMessage} from "../util/utils";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
export class CacheClear extends ChatCommand {
regexp = /^\/clearcache$/i;
requirements = Requirements.Build(Requirement.BOT_CREATOR);
async execute(msg: Message): Promise<void> {
const size = MessageStore.all().size;
MessageStore.clear();
await sendMessage({chatId: msg.chat.id, text: `Было удалено сообщений: ${size}`}).catch(logError);
}
}
-17
View File
@@ -1,17 +0,0 @@
import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {logError, sendMessage} from "../util/utils";
import {MessageStore} from "../common/message-store";
export class CacheSize extends ChatCommand {
regexp = /^\/cachesize$/i;
async execute(msg: Message): Promise<void> {
const cacheSize = MessageStore.all();
await sendMessage({
chatId: msg.chat.id,
text: `Количество сохранённых сообщений: ${cacheSize.size}`
}).catch(logError);
}
}