Files
Ultroid-fork/plugins/cleanaction.py
Devesh Pal 0df53caf4c Ultroid v0.3 Updates
Co-authored-by: Aditya <xditya@ultroid.tech>
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: TechiError <error@notavailable.live>
Co-authored-by: Avish Kumar <85635883+aviskumar@users.noreply.github.com>
Co-authored-by: Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ <87496159+harpia-vieillot@users.noreply.github.com>
Co-authored-by: Shrimadhav U K <6317196+spechide@users.noreply.github.com>
Co-authored-by: Dark <darkbeamer.official@gmail.com>
Co-authored-by: Muhamad Risman Aziz <62795826+mrismanaziz@users.noreply.github.com>
Co-authored-by: Ashik Muhammed <84127769+MR-JINN-OF-TG@users.noreply.github.com>
Co-authored-by: MMETMA <79155572+MMETMA@users.noreply.github.com>
Co-authored-by: amirmehdinzri <94852182+amirmehdinzri@users.noreply.github.com>
2021-12-31 23:48:53 +05:30

59 lines
1.5 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2021-2022 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/>.
"""
✘ Commands Available -
•`{i}addclean`
Clean all Upcoming action msg in added chat like someone joined/left/pin etc.
•`{i}remclean`
Remove chat from database.
•`{i}listclean`
To get list of all chats where its activated.
"""
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):
k = udB.get_key("CLEANCHAT")
if k:
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"
await e.eor(o)
else:
await e.eor(get_string("clan_4"), time=5)