From 7382c1748b8965a380263dbc7cafda3d09158f74 Mon Sep 17 00:00:00 2001 From: hkc Date: Fri, 15 Nov 2024 11:18:15 +0300 Subject: [PATCH] Added debug dump command that also shames you if you're not me. has no effect on it, still shows stuff in logs --- nfuck/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nfuck/__init__.py b/nfuck/__init__.py index 8990a08..d2a6ee1 100644 --- a/nfuck/__init__.py +++ b/nfuck/__init__.py @@ -5,6 +5,7 @@ from aiogram.filters import Command from httpx import AsyncClient from asyncio import sleep from urllib.parse import urlencode +from logging import DEBUG, getLogger from nfuck.link_verifier import ( explain_verification, @@ -15,6 +16,8 @@ from nfuck.utils import sanitize_link dp = Dispatcher() +logger = getLogger("nfuck.__init__") +logger.setLevel(DEBUG) SILENT_REMOVAL_IDS: set[int] = set(list(map(int, filter(lambda v: v, getenv("SILENT_REMOVAL_IDS", "").split(","))))) @@ -52,6 +55,16 @@ async def on_check(message: Message): else: await message.reply(":shrug:") +@dp.message(Command("dump")) +async def on_dump(message: Message): + logger.info(message.model_dump_json()) + kinky = "" + if message.from_user and message.from_user.id != 548392265: + kinky = " Too bad you probably can't read it" + msg = await message.reply("Message JSON *should* be in logs now." + kinky) + await sleep(3) + await msg.delete() + @dp.message(Command("force")) async def on_force(message: Message): if not message.reply_to_message: