py-tgcalls 2.2.5__py3-none-any.whl → 2.2.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-tgcalls
3
- Version: 2.2.5
3
+ Version: 2.2.6
4
4
  Summary: Async client API for the Telegram Calls.
5
5
  Author-email: Laky-64 <iraci.matteo@gmail.com>
6
6
  Project-URL: Homepage, https://pytgcalls.github.io/
@@ -20,7 +20,7 @@ Requires-Python: >=3.9
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: aiohttp>=3.9.3
23
- Requires-Dist: ntgcalls<3.0.0,>=2.0.5
23
+ Requires-Dist: ntgcalls<3.0.0,>=2.0.6
24
24
  Requires-Dist: deprecation
25
25
  Provides-Extra: pyrogram
26
26
  Requires-Dist: pyrogram>=1.2.20; extra == "pyrogram"
@@ -1,6 +1,6 @@
1
- py_tgcalls-2.2.5.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
1
+ py_tgcalls-2.2.6.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
2
2
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
3
- pytgcalls/__version__.py,sha256=btKTVVdL8jf2J-q4jm7Otknf3xzOoPGoGVBFald8zts,22
3
+ pytgcalls/__version__.py,sha256=ki8CvreWdC_q66zVTHoUGjT2EI8obe9OHjOQcNZfOfM,22
4
4
  pytgcalls/chat_lock.py,sha256=u3t0G3EQ20zn89Sn5s-GWFFX9Xmu4gYWkAgzHJOk0Mc,762
5
5
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
6
6
  pytgcalls/exceptions.py,sha256=Rijc-8T93WEWJxNW9jncU8_M6mYZZZcs8F2bqitEIeI,3787
@@ -31,11 +31,11 @@ pytgcalls/methods/__init__.py,sha256=KKnG3uI_3oKKBByQ96kHJiabjxk2J6YLs4HDfOKvQ0A
31
31
  pytgcalls/methods/calls/__init__.py,sha256=xg4DZZClEnxwaj-DAq3e8gSR-g-MiYBdUEBth64lSXA,214
32
32
  pytgcalls/methods/calls/change_volume_call.py,sha256=xMUszg44Gs1RgTXGCwcWEESnwu3XVkW8Kx9HGLDGSEo,842
33
33
  pytgcalls/methods/calls/get_participants.py,sha256=HDEMwZwNZM7KSb76P5XVH46qNONvBEVg4x_e-rgJscI,716
34
- pytgcalls/methods/calls/leave_call.py,sha256=XiaKrnSgaItbAIUpdGXCo1HgXY7V7FcDjRsi5OwNweY,1609
34
+ pytgcalls/methods/calls/leave_call.py,sha256=KRwT1XGFvBeBZWzvfnEUWLXExKYGWIwOGDCa-qgH7go,1518
35
35
  pytgcalls/methods/decorators/__init__.py,sha256=TCGaEVZnHjtOwv-3PNfaCVm0kyFhJApUPUNntt6MwyM,78
36
36
  pytgcalls/methods/decorators/on_update.py,sha256=ZTL4YcQk0N4Ru56a5WItUvkSN5SAqr6_RDZvXmZMIHs,316
37
37
  pytgcalls/methods/internal/__init__.py,sha256=fcgIxUJKT6QJD30ltnOfzKsLhzTTTklD2qxKlwCvyv0,1057
38
- pytgcalls/methods/internal/clear_cache.py,sha256=IbcDOGiBJbmqOnGJWkIe8c6P_Y6e0YPkui4Hg4PAZlA,334
38
+ pytgcalls/methods/internal/clear_cache.py,sha256=PpY91nAHlsl05eL_t8yhHmDrJ2ZINkEs-umPbv44QuA,380
39
39
  pytgcalls/methods/internal/clear_call.py,sha256=r9v2oPGrDfplxqlfKxT95JjOijm6daIpQjisOyKDBrA,542
40
40
  pytgcalls/methods/internal/connect_call.py,sha256=wgRtcY-YxGDFCJcLkSIqgc81DdoA9osQ_iEErqbBH7E,5770
41
41
  pytgcalls/methods/internal/emit_sig_data.py,sha256=ucIsknhJHB-0x7lcymXvwQ647AJQ852zH2W6MdlC3ws,216
@@ -73,10 +73,10 @@ pytgcalls/methods/utilities/stream_params.py,sha256=PUnctLhdCeBAg52v95vpxj-42Le5
73
73
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
74
74
  pytgcalls/mtproto/bridged_client.py,sha256=Qb9-9FrUdh3g_sx-JOcvkzv3kJtS_pz2Qaos85DgVPI,8280
75
75
  pytgcalls/mtproto/client_cache.py,sha256=5unu8sjLRaIKoEgJGaIRjhA4P3U2lFpfakTKFxKLzAM,5591
76
- pytgcalls/mtproto/hydrogram_client.py,sha256=P2YpeIBYXzBHWLXyk9pGiO_TsIBuzDQ7LvorGZFFM-o,28974
76
+ pytgcalls/mtproto/hydrogram_client.py,sha256=R0VsYhesIhvXeEi0qI-BdQSDE9fBpjFp7j8EI6B8Y4U,29419
77
77
  pytgcalls/mtproto/mtproto_client.py,sha256=9SIG3DNeICIXvggyVE8DQWtToPtxV0t9ZKr6dEMnEMg,8783
78
- pytgcalls/mtproto/pyrogram_client.py,sha256=CI9uPMdwwE3UGSNfenqIKUl-UD_caVZpCzYR1PB4drY,28970
79
- pytgcalls/mtproto/telethon_client.py,sha256=w9PuqE_gsDKFYVpF5o_ULMSsYf5sAK8VgImVxbNz2Bc,27106
78
+ pytgcalls/mtproto/pyrogram_client.py,sha256=-n40vFJ9vWESiLNGQSrMudRkduwbi1250wGZDnIKqWo,29415
79
+ pytgcalls/mtproto/telethon_client.py,sha256=DbHyBpLKd0XxxfEK9Yc0WXfRCTsJNCyD0YveexaT018,27561
80
80
  pytgcalls/types/__init__.py,sha256=GlgBBXAwbNopXSeTTmiXktrEJhhN_rMBtuAllTBbN3k,1189
81
81
  pytgcalls/types/browsers.py,sha256=47Kr5q96n4Q4WvVhA6IUlS2egEcA9GRLlDeFcQYyc9M,9545
82
82
  pytgcalls/types/cache.py,sha256=nJh6B7xnvAiLh0mDJYS9sYhnRvj0BqxrQBLXs4WEUMs,1235
@@ -117,7 +117,7 @@ pytgcalls/types/stream/record_stream.py,sha256=f4VQ6MY8HtOxt7vz0hWBFmbbAIvTRHpAI
117
117
  pytgcalls/types/stream/stream_ended.py,sha256=xR_kZwFf03hA6rw_nvI7Be7GwoCKzQf_1MKaGpPDXqY,716
118
118
  pytgcalls/types/stream/stream_frames.py,sha256=028ZhNV-mN3BGqMlmxusAV1xDQpXRYCeM0WXBZhRUhA,446
119
119
  pytgcalls/types/stream/video_quality.py,sha256=eMCBFPwh5meX3UVEaozcGlwmgaujfpiTa3vBVSBBP_8,275
120
- py_tgcalls-2.2.5.dist-info/METADATA,sha256=z5H1ZrBVTaaYMqaL4L__jniTrocWWAkdUcnF-FOCEPs,5280
121
- py_tgcalls-2.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
122
- py_tgcalls-2.2.5.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
123
- py_tgcalls-2.2.5.dist-info/RECORD,,
120
+ py_tgcalls-2.2.6.dist-info/METADATA,sha256=rXpf6_vJUsYVA4FG_pfww_trvXg26tszEQH4GhWSlTg,5280
121
+ py_tgcalls-2.2.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
122
+ py_tgcalls-2.2.6.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
123
+ py_tgcalls-2.2.6.dist-info/RECORD,,
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.2.5'
1
+ __version__ = '2.2.6'
@@ -46,9 +46,7 @@ class LeaveCall(Scaffold):
46
46
  self._p2p_configs.pop(chat_id)
47
47
  return
48
48
  if chat_id < 0: # type: ignore
49
- self._need_unmute.discard(chat_id)
50
- self._presentations.discard(chat_id)
51
- self._call_sources.pop(chat_id, None)
49
+ self._clear_cache(chat_id) # type: ignore
52
50
 
53
51
  if chat_id < 0 and close: # type: ignore
54
52
  await self._app.close_voice_chat(chat_id)
@@ -7,4 +7,5 @@ class ClearCache(Scaffold):
7
7
  self._cache_user_peer.pop(chat_id)
8
8
  self._need_unmute.discard(chat_id)
9
9
  self._presentations.discard(chat_id)
10
+ self._call_sources.pop(chat_id, None)
10
11
  self._pending_connections.pop(chat_id, None)
@@ -72,6 +72,7 @@ from hydrogram.session import Auth
72
72
  from hydrogram.session import Session
73
73
  from ntgcalls import MediaSegmentQuality
74
74
  from ntgcalls import Protocol
75
+ from pyrogram.errors import GroupcallForbidden
75
76
 
76
77
  from ..types import CallProtocol
77
78
  from ..types import ChatUpdate
@@ -414,33 +415,43 @@ class HydrogramClient(BridgedClient):
414
415
  video_stopped: bool,
415
416
  join_as: InputPeer,
416
417
  ) -> str:
417
- chat_call = await self._cache.get_full_chat(chat_id)
418
- if chat_call is not None:
419
- result: Updates = await self._invoke(
420
- JoinGroupCall(
421
- call=chat_call,
422
- params=DataJSON(data=json_join),
423
- muted=False,
424
- join_as=join_as,
425
- video_stopped=video_stopped,
426
- invite_hash=invite_hash,
427
- ),
418
+ try:
419
+ chat_call = await self._cache.get_full_chat(chat_id)
420
+ if chat_call is not None:
421
+ result: Updates = await self._invoke(
422
+ JoinGroupCall(
423
+ call=chat_call,
424
+ params=DataJSON(data=json_join),
425
+ muted=False,
426
+ join_as=join_as,
427
+ video_stopped=video_stopped,
428
+ invite_hash=invite_hash,
429
+ ),
430
+ )
431
+ for update in result.updates:
432
+ if isinstance(
433
+ update,
434
+ UpdateGroupCallParticipants,
435
+ ):
436
+ participants = update.participants
437
+ for participant in participants:
438
+ self._cache.set_participants_cache(
439
+ chat_id,
440
+ update.call.id,
441
+ self.parse_participant_action(participant),
442
+ self.parse_participant(participant),
443
+ )
444
+ if isinstance(update, UpdateGroupCallConnection):
445
+ return update.params.data
446
+ except GroupcallForbidden:
447
+ self._cache.drop_cache(chat_id)
448
+ return await self.join_group_call(
449
+ chat_id,
450
+ json_join,
451
+ invite_hash,
452
+ video_stopped,
453
+ join_as,
428
454
  )
429
- for update in result.updates:
430
- if isinstance(
431
- update,
432
- UpdateGroupCallParticipants,
433
- ):
434
- participants = update.participants
435
- for participant in participants:
436
- self._cache.set_participants_cache(
437
- chat_id,
438
- update.call.id,
439
- self.parse_participant_action(participant),
440
- self.parse_participant(participant),
441
- )
442
- if isinstance(update, UpdateGroupCallConnection):
443
- return update.params.data
444
455
 
445
456
  return json.dumps({'transport': None})
446
457
 
@@ -12,6 +12,7 @@ from pyrogram.errors import AuthBytesInvalid
12
12
  from pyrogram.errors import BadRequest
13
13
  from pyrogram.errors import FileMigrate
14
14
  from pyrogram.errors import FloodWait
15
+ from pyrogram.errors import GroupcallForbidden
15
16
  from pyrogram.raw.base import InputPeer
16
17
  from pyrogram.raw.base import InputUser
17
18
  from pyrogram.raw.functions.auth import ExportAuthorization
@@ -415,33 +416,43 @@ class PyrogramClient(BridgedClient):
415
416
  video_stopped: bool,
416
417
  join_as: InputPeer,
417
418
  ) -> str:
418
- chat_call = await self._cache.get_full_chat(chat_id)
419
- if chat_call is not None:
420
- result: Updates = await self._invoke(
421
- JoinGroupCall(
422
- call=chat_call,
423
- params=DataJSON(data=json_join),
424
- muted=False,
425
- join_as=join_as,
426
- video_stopped=video_stopped,
427
- invite_hash=invite_hash,
428
- ),
419
+ try:
420
+ chat_call = await self._cache.get_full_chat(chat_id)
421
+ if chat_call is not None:
422
+ result: Updates = await self._invoke(
423
+ JoinGroupCall(
424
+ call=chat_call,
425
+ params=DataJSON(data=json_join),
426
+ muted=False,
427
+ join_as=join_as,
428
+ video_stopped=video_stopped,
429
+ invite_hash=invite_hash,
430
+ ),
431
+ )
432
+ for update in result.updates:
433
+ if isinstance(
434
+ update,
435
+ UpdateGroupCallParticipants,
436
+ ):
437
+ participants = update.participants
438
+ for participant in participants:
439
+ self._cache.set_participants_cache(
440
+ chat_id,
441
+ update.call.id,
442
+ self.parse_participant_action(participant),
443
+ self.parse_participant(participant),
444
+ )
445
+ if isinstance(update, UpdateGroupCallConnection):
446
+ return update.params.data
447
+ except GroupcallForbidden:
448
+ self._cache.drop_cache(chat_id)
449
+ return await self.join_group_call(
450
+ chat_id,
451
+ json_join,
452
+ invite_hash,
453
+ video_stopped,
454
+ join_as,
429
455
  )
430
- for update in result.updates:
431
- if isinstance(
432
- update,
433
- UpdateGroupCallParticipants,
434
- ):
435
- participants = update.participants
436
- for participant in participants:
437
- self._cache.set_participants_cache(
438
- chat_id,
439
- update.call.id,
440
- self.parse_participant_action(participant),
441
- self.parse_participant(participant),
442
- )
443
- if isinstance(update, UpdateGroupCallConnection):
444
- return update.params.data
445
456
 
446
457
  return json.dumps({'transport': None})
447
458
 
@@ -10,6 +10,7 @@ from telethon.errors import BadRequestError
10
10
  from telethon.errors import ChannelPrivateError
11
11
  from telethon.errors import FileMigrateError
12
12
  from telethon.errors import FloodWaitError
13
+ from telethon.errors import GroupcallForbiddenError
13
14
  from telethon.events import Raw
14
15
  from telethon.tl.functions.channels import GetFullChannelRequest
15
16
  from telethon.tl.functions.messages import GetDhConfigRequest
@@ -401,33 +402,43 @@ class TelethonClient(BridgedClient):
401
402
  video_stopped: bool,
402
403
  join_as: TypeInputPeer,
403
404
  ) -> str:
404
- chat_call = await self._cache.get_full_chat(chat_id)
405
- if chat_call is not None:
406
- result: Updates = await self._invoke(
407
- JoinGroupCallRequest(
408
- call=chat_call,
409
- params=DataJSON(data=json_join),
410
- muted=False,
411
- join_as=join_as,
412
- video_stopped=video_stopped,
413
- invite_hash=invite_hash,
414
- ),
405
+ try:
406
+ chat_call = await self._cache.get_full_chat(chat_id)
407
+ if chat_call is not None:
408
+ result: Updates = await self._invoke(
409
+ JoinGroupCallRequest(
410
+ call=chat_call,
411
+ params=DataJSON(data=json_join),
412
+ muted=False,
413
+ join_as=join_as,
414
+ video_stopped=video_stopped,
415
+ invite_hash=invite_hash,
416
+ ),
417
+ )
418
+ for update in result.updates:
419
+ if isinstance(
420
+ update,
421
+ UpdateGroupCallParticipants,
422
+ ):
423
+ participants = update.participants
424
+ for participant in participants:
425
+ self._cache.set_participants_cache(
426
+ chat_id,
427
+ update.call.id,
428
+ self.parse_participant_action(participant),
429
+ self.parse_participant(participant),
430
+ )
431
+ if isinstance(update, UpdateGroupCallConnection):
432
+ return update.params.data
433
+ except GroupcallForbiddenError:
434
+ self._cache.drop_cache(chat_id)
435
+ return await self.join_group_call(
436
+ chat_id,
437
+ json_join,
438
+ invite_hash,
439
+ video_stopped,
440
+ join_as,
415
441
  )
416
- for update in result.updates:
417
- if isinstance(
418
- update,
419
- UpdateGroupCallParticipants,
420
- ):
421
- participants = update.participants
422
- for participant in participants:
423
- self._cache.set_participants_cache(
424
- chat_id,
425
- update.call.id,
426
- self.parse_participant_action(participant),
427
- self.parse_participant(participant),
428
- )
429
- if isinstance(update, UpdateGroupCallConnection):
430
- return update.params.data
431
442
 
432
443
  return json.dumps({'transport': None})
433
444