updates
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user