from telethon import TelegramClient import asyncio api_id = # Your API_ID api_hash = "" # Your APP_ID bot_token = "" # via botfather group_id = async def get_users(client, group_id): async for user in client.iter_participants(group_id): if not user.deleted and not user.bot: print("id:", user.id, "username:", user.username, "first_name:", user.first_name) bot = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token) with bot: asyncio.get_event_loop().run_until_complete(get_users(bot, group_id))