how i can restore sessions old in telethon telegram and connect this again(without send again code))

后端 未结 2 1023
旧巷少年郎
旧巷少年郎 2021-01-16 12:19

i use this script for connect and create sessions in telethon

from telethon import TelegramClient
from telethon.tl.functions.messages import GetHistoryReques         


        
2条回答
  •  情话喂你
    2021-01-16 12:26

    from telethon import TelegramClient
    
    # These example values won't work. You must get your own api_id and
    # api_hash from https://my.telegram.org, under API Development.
    api_id = ****** # Your api_id
    api_hash = '********************************' # Your api_hash
    phone_number = '+989122594574' # Your phone number
    
    client = TelegramClient(phone_number, api_id, api_hash)
    client.connect()
    
    if not client.is_user_authorized():
        client.send_code_request(phone_number)
        client.sign_in(phone_number, input('Enter the code: '))
    
    
    client.send_message('amir2b', 'Hello! Amir Bashiri')
    

提交回复
热议问题