Added debug dump command

that also shames you if you're not me. has no effect on it, still shows
stuff in logs
This commit is contained in:
Casey 2024-11-15 11:18:15 +03:00
parent 892cdf5478
commit 7382c1748b
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from aiogram.filters import Command
from httpx import AsyncClient from httpx import AsyncClient
from asyncio import sleep from asyncio import sleep
from urllib.parse import urlencode from urllib.parse import urlencode
from logging import DEBUG, getLogger
from nfuck.link_verifier import ( from nfuck.link_verifier import (
explain_verification, explain_verification,
@ -15,6 +16,8 @@ from nfuck.utils import sanitize_link
dp = Dispatcher() 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(","))))) 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: else:
await message.reply(":shrug:") 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")) @dp.message(Command("force"))
async def on_force(message: Message): async def on_force(message: Message):
if not message.reply_to_message: if not message.reply_to_message: