Advertisement
askanton

Получаем данные пользователей, username, user id, из групп телеграм

Mar 5th, 2021 (edited)
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from telethon import TelegramClient
  2. api_id = '********'
  3. api_hash = '***************'
  4. client = TelegramClient('my_account', api_id, api_hash)
  5.  
  6. chtid = -************
  7. clean_usernames = []
  8.  
  9. async def getter():
  10.     participants = await client.get_participants(chtid)
  11.     print(participants)
  12.     #for user in participants:
  13.      #   if user.id is not None:
  14.       #      clean_usernames.append(user.id)
  15.     #print(clean_usernames)
  16.  
  17. with client:
  18.     client.loop.run_until_complete(getter())
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement