azils3/bash
0
1# Ultroid - UserBot2# Copyright (C) 2021-2025 TeamUltroid3#4# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >5# PLease read the GNU Affero General Public License in6# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.7 8from . import get_help9 10__doc__ = get_help("help_blacklist")11 12 13from pyUltroid.dB.blacklist_db import (14 add_blacklist,15 get_blacklist,16 list_blacklist,17 rem_blacklist,18)19 20from . import events, get_string, udB, ultroid_bot, ultroid_cmd21 22 23@ultroid_cmd(pattern="blacklist( (.*)|$)", admins_only=True)24async def af(e):25 wrd = e.pattern_match.group(1).strip()26 chat = e.chat_id27 if not (wrd):28 return await e.eor(get_string("blk_1"), time=5)29 wrd = e.text[11:]30 heh = wrd.split(" ")31 for z in heh:32 add_blacklist(int(chat), z.lower())33 ultroid_bot.add_handler(blacklist, events.NewMessage(incoming=True))34 await e.eor(get_string("blk_2").format(wrd))35 36 37@ultroid_cmd(pattern="remblacklist( (.*)|$)", admins_only=True)38async def rf(e):39 wrd = e.pattern_match.group(1).strip()40 chat = e.chat_id41 if not wrd:42 return await e.eor(get_string("blk_3"), time=5)43 wrd = e.text[14:]44 heh = wrd.split(" ")45 for z in heh:46 rem_blacklist(int(chat), z.lower())47 await e.eor(get_string("blk_4").format(wrd))48 49 50@ultroid_cmd(pattern="listblacklist$", admins_only=True)51async def lsnote(e):52 if x := list_blacklist(e.chat_id):53 sd = get_string("blk_5")54 return await e.eor(sd + x)55 await e.eor(get_string("blk_6"))56 57 58async def blacklist(e):59 if x := get_blacklist(e.chat_id):60 text = e.text.lower().split()61 if any((z in text) for z in x):62 try:63 await e.delete()64 except BaseException:65 pass66 67 68if udB.get_key("BLACKLIST_DB"):69 ultroid_bot.add_handler(blacklist, events.NewMessage(incoming=True))70 