What should I do if I want tag all members of a group in telegram python bot?

Viewed 15399

I have a telegram bot running on python and based on telethon library. I wanna tag all members in a group but my code source has 100 users tag limitation and when I want to increase its count to 500 users or even more it doesn't tag the entire users and just gives me the name of them, just tagging the first 100 users. Please help me how can I make it tagging all the members in a group without giving users count. The codes are as follows :

import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins

async def _(event):
    if event.fwd_from:
        return
    mentions = "All members tagged successfully!"
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat, 100):
        mentions += f" \n [{x.first_name}](tg://user?id={x.id})"
    await event.reply(mentions)
    await event.delete()

I can tag admins in groups via these codes:

async def _(event):
    if event.fwd_from:
        return
    mentions = "Administrators in the chat : "
    chat = await event.get_input_chat()
    async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins):
        mentions += f" \n [{x.first_name}](tg://user?id={x.id})"
    reply_message = None
    if event.reply_to_msg_id:
        reply_message = await event.get_reply_message()
        await reply_message.reply(mentions)
    else:
        await event.reply(mentions)
    await event.delete()

Can I add a filter like ChannelParticipantsAdmins in the code above instead of users count in the previous codes that was 100? If yes what the filter part should should be.

Thanks for your help.

1 Answers
Related