Files
Ultroid-fork/plugins/tag.py
1Danish-00 6f44b386aa v0.2 11/10/2021
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: Sonya Nikiforova <Sonniki@users.noreply.github.com>
Co-authored-by: M̲αραт <Marty2509@users.noreply.github.com>
Co-authored-by: Muhamad Risman Aziz <mrismanaziz@users.noreply.github.com>
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>
2021-10-11 00:27:23 +05:30

79 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
@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()