from telethon import TelegramClient, events, sync
from telethon.sessions import StringSession
#hevorix
api_id = 10953300
api_hash = "9c24426e5d6fa1d441913e3906627f87"
string = input('session code or press enter: ')
with TelegramClient(StringSession(string), api_id, api_hash) as client:
print('-----------------------------------------------------')
print(client.session.save())
print('-----------------------------------------------------')
async def main():
async for message in client.iter_messages(777000):
print(message.sender.username, message.text)
print('-----------------------------------------------------')
break
with client:
client.loop.run_until_complete(main())
videodagi dastur projectim session generate qilish uchun session code or press enter: deganda enter ni bosib shunchaki accni reg qib qoyaslar (tg akkni) va session generate bo'ladi!
code uchun ham shunday shunchaki enter bosmasdan sessionni joylab keyin enter bosasiz
dasturchi:
@hevorix #archive 2021