Dineshkarthik/telegram_media_downloader

GetChatHistory.get_chat_history() got an unexpected keyword argument 'reverse'

Exey opened this issue · 3 comments

Exey commented

Describe the bug
exception on py .\media_downloader.py

To Reproduce

chat_id: -1001632935915
last_read_message_id: 0
media_types:
- audio
- photo
- video
- document
- voice
file_formats:
  audio:
  - all
  document:
  - all
  video:
  - all

Python Version
Python: 3.11.4
pyrogram-2.0.106

OS:
Windows 10
WindowsVersion

1809

Logs
Traceback (most recent call last):
File "E:\tmd\x\media_downloader.py", line 376, in
main()
File "E:\tmd\x\media_downloader.py", line 360, in main
updated_config = asyncio.get_event_loop().run_until_complete(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Exey\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "E:\tmd\x\media_downloader.py", line 313, in begin_import
messages_iter = client.get_chat_history(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Exey\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\sync.py", line 53, in async_to_sync_wrap
coroutine = function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GetChatHistory.get_chat_history() got an unexpected keyword argument 'reverse'

Exey commented

After pip3 install -r requirements.txt
the same error but with heading:

py .\media_downloader.py
[17:43:34] Telegram Media Downloader v2.0.2,                                                                                                                                                                                                                                                               meta.py:18
           Copyright (C) 2019 Dineshkarthik <https://github.com/Dineshkarthik>
           Licensed under the terms of the MIT License                                                                                                                                                                                                                                                     meta.py:21

[17:43:34] INFO     Device: CPython 3.11.4 - Telegram Media Downloader 2.0.2                                                                                                                                                                                                                               meta.py:22
           INFO     System: Windows 10 (EN)                                                                                                                                                                                                                                                                meta.py:23
[17:43:35] INFO     Connecting...                                                                                                                                                                                                                                                                    connection.py:47
           INFO     Connected! Production DC2 - IPv4                                                                                                                                                                                                                                                 connection.py:54
           INFO     NetworkTask started                                                                                                                                                                                                                                                                session.py:294
           INFO     Session initialized: Layer 158                                                                                                                                                                                                                                                     session.py:139
           INFO     Device: CPython 3.11.4 - Pyrogram 2.0.106                                                                                                                                                                                                                                          session.py:140
           INFO     System: Windows 10 (en)                                                                                                                                                                                                                                                            session.py:141
           INFO     Session started                                                                                                                                                                                                                                                                    session.py:155
           INFO     PingTask started                                                                                                                                                                                                                                                                   session.py:272
           INFO     Started 32 HandlerTasks

Ran into the same issue and the cause it a change in the pyrogram library. Solution seems to be to just remove the argument reverse (and it's value of True) from media_downloader.py line 313.

"The messages are returned in reverse chronological order." by default since that change.

This issue has been automatically marked as stale because it has not had recent activity in the past 45 days. It will be closed if no further activity occurs in the next 7 days. Thank you for your contributions.