Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Client' object has no attribute 'send' with Pyrogram 2.0 #13

Open
afeno opened this issue Dec 30, 2023 · 3 comments
Open

'Client' object has no attribute 'send' with Pyrogram 2.0 #13

afeno opened this issue Dec 30, 2023 · 3 comments

Comments

@afeno
Copy link

afeno commented Dec 30, 2023

Hello,

I was forced to upgrade pyrogram to v2.0.106 due to a "The msg_id is too low, the client time has to be synchronized." Error.

Now, with pyrogram v2 I get the following error 'Client' object has no attribute 'send'" that seems to be generated from tgvoip_pyrogram/base_call.py

See logs below:

./make_call.py
TgCrypto is missing! Pyrogram will work the same, but at a much slower speed. More info: https://docs.pyrogram.org/topics/speedups
D/tgvoip: === Updating voip config ===
D/tgvoip: {"audio_init_bitrate": 80000, "audio_max_bitrate": 100000, "audio_min_bitrate": 60000, "audio_bitrate_step_decr": 5000, "audio_bitrate_step_incr": 5000}
Traceback (most recent call last):
  File "./make_call.py", line 35, in <module>
    loop.run_until_complete(main())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
    return future.result()
  File "./make_call.py", line 19, in main
    call = await voip_service.start_call('@alfredofenoglio')
  File "/home/ubuntu/.local/lib/python3.7/site-packages/tgvoip_pyrogram/service.py", line 52, in start_call
    await call.request()
  File "/home/ubuntu/.local/lib/python3.7/site-packages/tgvoip_pyrogram/outgoing_call.py", line 43, in request
    await self.get_dhc()
  File "/home/ubuntu/.local/lib/python3.7/site-packages/tgvoip_pyrogram/base_call.py", line 117, in get_dhc
    self.dhc = DH(await self.client.send(functions.messages.GetDhConfig(version=0, random_length=256)))
AttributeError: 'Client' object has no attribute 'send'
D/tgvoip: Entered VoIPController::Stop

As usual, my skills are not high enough to fix or find the root cause of the problem.... Any idea? Any help?

@afeno afeno changed the title 'Client' object has no attribute 'send' 'Client' object has no attribute 'send' with Pyrogram 2.0 Dec 30, 2023
@dauheeIRL
Copy link

I get this also and I upgraded tgcrypto also just in case. I doublechecked the examples in https://github.com/bakatrouble/pytgvoip_pyrogram/blob/async/examples/make_call.py but that is unchanged

@afeno
Copy link
Author

afeno commented Jan 12, 2024

This is because "send" has been renamed to "invoke" in Pyrogram v2. You need to modify the code and rename the methods. See here: https://docs.pyrogram.org/releases/v2.0

@dauheeIRL
Copy link

thanks so much. I changed base_call.py and outgoing_call.py and it worked great, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants