Files
Ultroid-fork/plugins/cleanaction.py
Devesh Pal 0afa1ade15 AI wrapper and twitter plugin (#465)
* Ultroid 2025

Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
Co-authored-by: Amit Sharma <buddhhu@users.noreply.github.com>
Co-authored-by: TechiError <techierror@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
2025-02-21 23:05:48 +05:30

49 lines
1.3 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2021-2025 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
from . import get_help
__doc__ = get_help("help_cleanaction")
from telethon.utils import get_display_name
from . import get_string, udB, ultroid_cmd
@ultroid_cmd(pattern="addclean$", admins_only=True)
async def _(e):
key = udB.get_key("CLEANCHAT") or []
if e.chat_id in key:
return await eod(e, get_string("clan_5"))
key.append(e.chat_id)
udB.set_key("CLEANCHAT", key)
await e.eor(get_string("clan_1"), time=5)
@ultroid_cmd(pattern="remclean$")
async def _(e):
key = udB.get_key("CLEANCHAT") or []
if e.chat_id in key:
key.remove(e.chat_id)
udB.set_key("CLEANCHAT", key)
await e.eor(get_string("clan_2"), time=5)
@ultroid_cmd(pattern="listclean$")
async def _(e):
if k := udB.get_key("CLEANCHAT"):
o = ""
for x in k:
try:
title = get_display_name(await e.client.get_entity(x))
except BaseException:
title = get_string("clan_3")
o += f"{x} {title}\n"
return await e.eor(o)
await e.eor(get_string("clan_4"), time=5)