From 639a962d2c1c3e25395d1e5d1c74afc5e6251784 Mon Sep 17 00:00:00 2001 From: hkc Date: Mon, 5 Feb 2024 17:49:11 +0300 Subject: [PATCH] Added silencer for some chats --- nfuck/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nfuck/__init__.py b/nfuck/__init__.py index cbb183d..b8521f3 100644 --- a/nfuck/__init__.py +++ b/nfuck/__init__.py @@ -1,3 +1,4 @@ +from os import getenv from aiogram import Dispatcher from aiogram.types import Message from aiogram.filters import Command @@ -13,11 +14,7 @@ from nfuck.utils import sanitize_link dp = Dispatcher() -# @dp.message(Command("dd")) -# async def on_dd(message: Message): -# if message.reply_to_message: -# await message.reply_to_message.delete() - +SILENT_REMOVAL_IDS: set[int] = set(list(map(int, getenv("SILENT_REMOVAL_IDS", "").split(",")))) @dp.message(Command("check")) async def on_check(message: Message): @@ -68,7 +65,7 @@ async def on_message(message: Message): if confidence > 0.9: detected_links.append((entity.url, confidence)) if detected_links: - if message.from_user: + if message.from_user and message.chat.id not in SILENT_REMOVAL_IDS: await message.reply( str.join( "\n",