add debug command

This commit is contained in:
2026-01-22 17:04:38 +03:00
parent 04c458ce10
commit a428134218
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import {ChatCommand} from "../base/chat-command";
import {Message} from "typescript-telegram-bot-api";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {logError, replyToMessage} from "../util/utils";
export class Debug extends ChatCommand {
requirements = Requirements.Build(Requirement.BOT_ADMIN);
async execute(msg: Message): Promise<void> {
const msgToDebug = msg.reply_to_message ? msg.reply_to_message : msg;
const json = JSON.stringify(msgToDebug, null, 2);
const text = `\`\`\`json\n${json}\n\`\`\``;
await replyToMessage({message: msg, text: text, parse_mode: "Markdown"}).catch(logError);
}
}