tclient = TelegramClient('session_name', api_id, api_hash)
tclient.connect()
if not tclient.is_user_authorized():
tclient.send_code_request(phone)
myself = tclient.sign_in(phone, input('Enter code: '))
lastmessage = 0
last_date = None
chunk_size = 20
chan_type = 'channel'
result = tclient(GetDialogsRequest(
offset_date=last_date,
offset_id=0,
offset_peer=InputPeerEmpty(),
limit=chunk_size
))
pp.pprint(result)
C:\Users\Administrator\Desktop\ParserBot\telelooper.py:42: RuntimeWarning: coroutine 'TelegramBaseClient.connect' was never awaited
tclient.connect()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\Administrator\Desktop\ParserBot\telelooper.py:43: RuntimeWarning: coroutine 'UserMethods.is_user_authorized' was never awaited
if not tclient.is_user_authorized():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ParserBot\telelooper.py", line 51, in <module>
result = tclient(GetDialogsRequest(
TypeError: __init__() missing 1 required positional argument: 'hash'
Connecting to Telegram...
Process finished with exit code 1
tclient.connect()
if not tclient.is_user_authorized():
tclient.send_code_request(phone)
myself = tclient.sign_in(phone, input('Enter code: '))
result = tclient(GetDialogsRequest(
offset_date=last_date,
offset_id=0,
offset_peer=InputPeerEmpty(),
limit=chunk_size
))
result = tclient.some_method(GetDialogsRequest(
offset_date=last_date,
offset_id=0,
offset_peer=InputPeerEmpty(),
limit=chunk_size
))