filippz / telegram_import

Import back messages exported from Telegram into JSON format
14 stars 2 forks source link

Error with attribute 'CheckHistoryImportRequest' #4

Closed blink-led closed 7 months ago

blink-led commented 7 months ago

Trying your script, I'm experiencing some issue:

Traceback (most recent call last):
  File "telegram_import.py", line 241, in <module>
    import_history(
  File "telegram_import.py", line 185, in import_history
    (functions.messages.CheckHistoryImportRequest(
AttributeError: module 'telethon.tl.functions.messages' has no attribute 'CheckHistoryImportRequest'

Any hint for solve that?

Module Telethon installed:

Name: Telethon
Version: 1.14.0
Summary: Full-featured Telegram client library for Python 3
Home-page: https://github.com/LonamiWebs/Telethon
Author: Lonami Exo
Author-email: totufals@hotmail.com
License: MIT
Location: /home/user/.local/lib/python3.8/site-packages
Requires: rsa, pyaes
Required-by:

Thanks!

filippz commented 7 months ago

That seem to be a rather outdated Telethon as version 1.14.0 was released in May 2020 - ie before the Telegram introduced the chat history import feature in Jan 2021. The last time I used this I was using 1.32.1 and it was working fine so please upgrade Telethon and try again.

blink-led commented 7 months ago

Good! With 1.32.1 I passed this error... new one received now :(

Traceback (most recent call last):
  File "telegram_import.py", line 243, in <module>
    import_history(
  File "telegram_import.py", line 192, in import_history
    client(functions.messages.CheckHistoryImportPeerRequest(
  File "/home/jferna16/.local/lib/python3.8/site-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/jferna16/.local/lib/python3.8/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/home/jferna16/.local/lib/python3.8/site-packages/telethon/client/users.py", line 87, in _call
    result = await future
telethon.errors.rpcerrorlist.PeerIdInvalidError: An invalid Peer was used. Make sure to pass the right peer type and that the value is valid (for instance, bots cannot start conversations) (caused by CheckHistoryImportPeerRequest)

I'm trying to recover a personal chat from myself and other person... do you know if some else is needed?

Many thanks!!

filippz commented 7 months ago

You are getting back an error from Telegram servers that seem to indicate that the peer (--peer) you're using is not valid. I typically used the exact phone number of the other person, but @ username should also be OK.