pytgvoip_pyrogram
pytgvoip_pyrogram copied to clipboard
'Client' object has no attribute 'send' with Pyrogram 2.0
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?
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
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
thanks so much. I changed base_call.py and outgoing_call.py and it worked great, thanks