Files
Ultroid-fork/plugins/tag.py
Devesh Pal 6c7af44f09 Ultroid v0.1 Updates 13.09.2021
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: sppidy <sppidy@users.noreply.github.com>
Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com>
Co-authored-by: divkix <divkix@users.noreply.github.com>
Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com>
Co-authored-by: Programming Error <error@notavailable.live>
2021-09-13 01:03:39 +05:30

80 lines
2.4 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2021 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}tagall`
Tag Top 100 Members of chat.
• `{i}tagadmins`
Tag Admins of that chat.
• `{i}tagowner`
Tag Owner of that chat
• `{i}tagbots`
Tag Bots of that chat.
• `{i}tagrec`
Tag recently Active Members.
• `{i}tagon`
Tag online Members(work only if privacy off).
• `{i}tagoff`
Tag Offline Members(work only if privacy off).
"""
from telethon.tl.types import ChannelParticipantAdmin as admin
from telethon.tl.types import ChannelParticipantCreator as owner
from telethon.tl.types import UserStatusOffline as off
from telethon.tl.types import UserStatusOnline as onn
from telethon.tl.types import UserStatusRecently as rec
from telethon.utils import get_display_name
from . import *
@ultroid_cmd(
pattern="tag(on|off|all|bots|rec|admins|owner)?(.*)",
groups_only=True,
)
async def _(e):
okk = e.text
lll = e.pattern_match.group(2)
o = 0
nn = 0
rece = 0
xx = f"{lll}" if lll else ""
lili = await e.client.get_participants(e.chat_id, limit=99)
for users, bb in enumerate(lili):
x = bb.status
y = bb.participant
if isinstance(x, onn):
o += 1
if "on" in okk:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
if isinstance(x, off):
nn += 1
if "off" in okk and not bb.bot and not bb.deleted:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
if isinstance(x, rec):
rece += 1
if "rec" in okk and not bb.bot and not bb.deleted:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
if isinstance(y, owner):
xx += f"\n꧁[{get_display_name(bb)}](tg://user?id={bb.id})꧂"
if isinstance(y, admin) and "admin" in okk and not bb.deleted:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
if "all" in okk and not bb.bot and not bb.deleted:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
if "bot" in okk and bb.bot:
xx += f"\n[{get_display_name(bb)}](tg://user?id={bb.id})"
await e.client.send_message(e.chat_id, xx)
await e.delete()