Team Ai
Apppublic

azils3/bash

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
filter_db.py48 linesDownload Raw Back to dB
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://github.com/TeamUltroid/pyUltroid/blob/main/LICENSE>.7 8from .. import udB9 10 11def get_stuff():12    return udB.get_key("FILTERS") or {}13 14 15def add_filter(chat, word, msg, media, button):16    ok = get_stuff()17    if ok.get(chat):18        ok[chat].update({word: {"msg": msg, "media": media, "button": button}})19    else:20        ok.update({chat: {word: {"msg": msg, "media": media, "button": button}}})21    udB.set_key("FILTERS", ok)22 23 24def rem_filter(chat, word):25    ok = get_stuff()26    if ok.get(chat) and ok[chat].get(word):27        ok[chat].pop(word)28        udB.set_key("FILTERS", ok)29 30 31def rem_all_filter(chat):32    ok = get_stuff()33    if ok.get(chat):34        ok.pop(chat)35        udB.set_key("FILTERS", ok)36 37 38def get_filter(chat):39    ok = get_stuff()40    if ok.get(chat):41        return ok[chat]42 43 44def list_filter(chat):45    ok = get_stuff()46    if ok.get(chat):47        return "".join(f"👉 `{z}`\n" for z in ok[chat])48