Skip to content

Instantly share code, notes, and snippets.

@abcwalk
Forked from rokibhasansagar/tg_group_cleaner.py
Last active January 24, 2024 18:56
Show Gist options
  • Save abcwalk/2acd57436885d51b4ef48c49db3d496f to your computer and use it in GitHub Desktop.
Save abcwalk/2acd57436885d51b4ef48c49db3d496f to your computer and use it in GitHub Desktop.
Получить информацию по пользователям в телеграм
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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment