py-tgcalls 2.1.0rc4__py3-none-any.whl → 2.1.0rc5__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.2
2
2
  Name: py-tgcalls
3
- Version: 2.1.0rc4
3
+ Version: 2.1.0rc5
4
4
  Summary: Async client API for the Telegram Calls.
5
5
  Author-email: Laky-64 <iraci.matteo@gmail.com>
6
6
  License: GNU LESSER GENERAL PUBLIC LICENSE
@@ -187,7 +187,7 @@ Requires-Python: >=3.9
187
187
  Description-Content-Type: text/markdown
188
188
  License-File: LICENSE
189
189
  Requires-Dist: aiohttp>=3.9.3
190
- Requires-Dist: ntgcalls<1.4.0,>=1.3.0b14
190
+ Requires-Dist: ntgcalls<1.4.0,>=1.3.0b15
191
191
  Requires-Dist: deprecation
192
192
  Provides-Extra: pyrogram
193
193
  Requires-Dist: pyrogram>=1.2.20; extra == "pyrogram"
@@ -228,16 +228,13 @@ This project allows making Telegram call using MtProto and WebRTC, this is possi
228
228
  ```python
229
229
  from pytgcalls import PyTgCalls
230
230
  from pytgcalls import idle
231
- from pytgcalls.types import MediaStream
232
231
  ...
233
232
  chat_id = -1001185324811
234
233
  app = PyTgCalls(client)
235
234
  app.start()
236
235
  app.play(
237
236
  chat_id,
238
- MediaStream(
239
- 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',
240
- )
237
+ 'http://docs.evostream.com/sample_content/assets/sintel1m720p.mp4',
241
238
  )
242
239
  idle()
243
240
  ```
@@ -1,9 +1,9 @@
1
1
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
2
- pytgcalls/__version__.py,sha256=bQyjq0CUvIVmXyMKMECcV2-QIaZZRwtmrdC0uwmXqC4,26
2
+ pytgcalls/__version__.py,sha256=QOpSP6brHLnWSrYC2nLbY_xxiEX1aNYsOQKAr2glkNA,26
3
3
  pytgcalls/environment.py,sha256=ctCHACvG6l8SdpPewSBhOvc70kbwpv18maC0TwLvZ08,1924
4
- pytgcalls/exceptions.py,sha256=0MmAktc53ajYAc7ThjD2tJ9PDyibUi0iHZMfUy2IoKs,4109
4
+ pytgcalls/exceptions.py,sha256=dBKyH--HyEJk6-DzfzXvG3M1fuDSRuF2LWu7XKhV-WY,4263
5
5
  pytgcalls/ffmpeg.py,sha256=tm6DBxyNfPh3h3an-b2s9x1UyX-cvkCdov9prlXxVZY,8649
6
- pytgcalls/filters.py,sha256=_TodZPFizBpH5ASGpiU92UBG2t4KUKyKDS2Dff03Dto,6041
6
+ pytgcalls/filters.py,sha256=qTFDlt-23xnMh_Ug2WmmOUf13JPX6_yacrv7c3F9Pp0,6125
7
7
  pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
8
8
  pytgcalls/mutex.py,sha256=Frjji5Ctzlk4AXEBuBLnDK-7HbtreoV6zuyKpFpMNI4,236
9
9
  pytgcalls/pytgcalls.py,sha256=oBcWgBwusnXmjHrLEE99VVXARReVyrXdn9SyeBWHbVo,1479
@@ -16,7 +16,7 @@ pytgcalls/ytdlp.py,sha256=jRA-mKQEXleWvaoGv9wtMa77aRjxsyQxn6_0tXI3-sA,2435
16
16
  pytgcalls/custom_api/__init__.py,sha256=ZT8d0lc2YrDuw_YSFAXXHHMewoXGFZ-ANOBIAr0vGFQ,60
17
17
  pytgcalls/custom_api/custom_api.py,sha256=Ko3aS6psrwPmOhRPxvG0fepXt4STrA0StvINSxz4Cj8,1890
18
18
  pytgcalls/handlers/__init__.py,sha256=pubbxI4pLqQpAKf8-toD6ija4cpSvbCJOQFjTiDjX1E,75
19
- pytgcalls/handlers/handlers_holder.py,sha256=ve83ydtKM5BjhsQmQ3mridD-3RnSVEi05-oDeiWv28w,1176
19
+ pytgcalls/handlers/handlers_holder.py,sha256=Rxy6MNdiGOOO5thxlQQyvuXmcbdCTe0N_Q4H6YzpjHU,1177
20
20
  pytgcalls/media_devices/__init__.py,sha256=QC7OccjY-YkcJ1xF9d1VRfM9hdgExWbInMYW92YBJ_s,309
21
21
  pytgcalls/media_devices/device_info.py,sha256=AleyVRXvZ0ylr03JQq8gPm5L-f5ySDwokDtW_Czcg50,266
22
22
  pytgcalls/media_devices/input_device.py,sha256=-Z5hjhdc1Y68mZQpVW-QgMePKGe_c5zJcYJHIzYElOY,225
@@ -25,20 +25,20 @@ pytgcalls/media_devices/screen_device.py,sha256=B1MCpcqW-QXKcVafNdPQfd2Es6-ejkX2
25
25
  pytgcalls/media_devices/speaker_device.py,sha256=39aAE2oEvlhRiUwHlIJCrSUPWIy-8J9_oq1TmCq5IjA,200
26
26
  pytgcalls/methods/__init__.py,sha256=hk1blAT5u_Isemdrg0nqInLsdRzTTZnak5NdAfkBPAk,217
27
27
  pytgcalls/methods/calls/__init__.py,sha256=xg4DZZClEnxwaj-DAq3e8gSR-g-MiYBdUEBth64lSXA,214
28
- pytgcalls/methods/calls/change_volume_call.py,sha256=viA3yHVxPJ421yE1dfFTh-kNEFTxMlaVFxVjC-PeX-0,719
29
- pytgcalls/methods/calls/get_participants.py,sha256=gKUAzvha1RpvbtSI_n-GlBQkOONxzibCaCr4aA17Mag,567
28
+ pytgcalls/methods/calls/change_volume_call.py,sha256=xMUszg44Gs1RgTXGCwcWEESnwu3XVkW8Kx9HGLDGSEo,842
29
+ pytgcalls/methods/calls/get_participants.py,sha256=HDEMwZwNZM7KSb76P5XVH46qNONvBEVg4x_e-rgJscI,716
30
30
  pytgcalls/methods/calls/leave_call.py,sha256=ay07za5mNKmXGzmpeU6gJJmHVrLeXRtRmFT4QP94pGA,1475
31
31
  pytgcalls/methods/decorators/__init__.py,sha256=TCGaEVZnHjtOwv-3PNfaCVm0kyFhJApUPUNntt6MwyM,78
32
32
  pytgcalls/methods/decorators/on_update.py,sha256=ZTL4YcQk0N4Ru56a5WItUvkSN5SAqr6_RDZvXmZMIHs,316
33
- pytgcalls/methods/stream/__init__.py,sha256=dBx5cqvVyvhqykIuT_2rYCAvIzuPM1J4Hh4sZ083UXU,412
34
- pytgcalls/methods/stream/mute_stream.py,sha256=auo2aAazfEC90Ab6MzaiPdddiJ1w4fN_9HaORkAeOBY,570
35
- pytgcalls/methods/stream/pause_stream.py,sha256=z_AIWABrQMHmTwvlah_PrH9EjXbro8gKxZni4Km5ICg,573
33
+ pytgcalls/methods/stream/__init__.py,sha256=mAcOih0-NT6T_Gspej6mySpJNPuEe46sUwgKV3vSvYM,336
34
+ pytgcalls/methods/stream/mute.py,sha256=ZrZS_EeNUeUxb6UgbdhwXUdRX826u-qSjH5a6sg7LsE,557
35
+ pytgcalls/methods/stream/pause.py,sha256=-kNvWQuv5VlssNcL-M6rkT5TKFmXlbOzJrDny95qsUc,560
36
36
  pytgcalls/methods/stream/play.py,sha256=-Ld5TQWLhU_ktKrb7q1Xrym36UGrWhaenIbjj-3mM3k,7524
37
37
  pytgcalls/methods/stream/record.py,sha256=28mFK2azDv6gUziwcj4ybvrYka9P9VXnUXnuAa1aQ5w,1466
38
- pytgcalls/methods/stream/resume_stream.py,sha256=z_DgP4cDExjEqEeX_ZL--50MXQ9lrATK876SIwE71PQ,576
38
+ pytgcalls/methods/stream/resume.py,sha256=AUHU3AtpXO2rtp2V1EKSC_KAWTk2KHMiHaqHluYy31M,563
39
39
  pytgcalls/methods/stream/send_frame.py,sha256=Kj9R8OqUM-g7pt-FiWP-US7sCFkH5ciPr9S8v-WPtLg,1062
40
- pytgcalls/methods/stream/time.py,sha256=5y9TMBf_d6YPLbMcGx3yMZQUZdo8zb5fQb9STsh7R3Y,656
41
- pytgcalls/methods/stream/unmute_stream.py,sha256=KUMhfMbhsPmZsmpF4cGWC1FVW7YwXha2MmQnqrBhM8s,576
40
+ pytgcalls/methods/stream/time.py,sha256=65Hc5pQaN6z6nxgwT9Zxgsnl_UosvMkcICqE2hisNWA,659
41
+ pytgcalls/methods/stream/unmute.py,sha256=wgWpxakIPLzZCgojC-cIkDSnF9LtDZwdTsBOctdHibQ,563
42
42
  pytgcalls/methods/utilities/__init__.py,sha256=HHAkTQEX_23uwo1fxnCIoE2rLBm7fKSQa52SwBLudTI,522
43
43
  pytgcalls/methods/utilities/cache_peer.py,sha256=Ylt0wCCJOoNKf1wZEXjfE8aBZKUIIgdRUFOMTGA5DfE,140
44
44
  pytgcalls/methods/utilities/call_holder.py,sha256=MhIbwCG6DROd9_bHGa6aqu-rB0y4sngzPBj82zLtAXU,1068
@@ -50,16 +50,16 @@ pytgcalls/methods/utilities/log_retries.py,sha256=6nD9J3350t82I0PKzK1pVx3ZaCBHAT
50
50
  pytgcalls/methods/utilities/ping.py,sha256=hhIMSHk2BzMB-IKpwLdZFVrsEvGm2ftJwKLs1k4anh8,244
51
51
  pytgcalls/methods/utilities/resolve_chat_id.py,sha256=92x2LHbUlnJMm-kS3fXOYmzYpY2TZbqtQD2rw3eBXDY,382
52
52
  pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xXVyrlg,152
53
- pytgcalls/methods/utilities/start.py,sha256=unc-O5XsUztJY7t7wu40F0uSthgq9YutcXRqcTTzhhA,14393
53
+ pytgcalls/methods/utilities/start.py,sha256=u9ahFbhE7sUTt8p8Lkam1eWor4Ys5lAmE35-SedMf0M,14387
54
54
  pytgcalls/methods/utilities/stream_params.py,sha256=OE673Bt1CiyCBFQGMPtC05zv3nObP3zirrh4OD9USdg,3109
55
55
  pytgcalls/methods/utilities/update_sources.py,sha256=ISF6u3rk4IcVrPOEOB-uZUDfnwUp2_y1_2g9GboXpWM,1562
56
56
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
57
57
  pytgcalls/mtproto/bridged_client.py,sha256=hktnfpfBK7PEL2n7Y0kBZzI7dkLlsdrDwkYliZki8zQ,5915
58
58
  pytgcalls/mtproto/client_cache.py,sha256=Mt0827e_T8DXJHOTkXhkIQUT9EUBWjoLcFcXP1gBnZY,5973
59
- pytgcalls/mtproto/hydrogram_client.py,sha256=HWYhScpVd7dwfuwngYcohHcNNnPZxcQA0mHb_HAp7SE,23020
59
+ pytgcalls/mtproto/hydrogram_client.py,sha256=SbyLIffnexzI6xuSkpqzChT70xGXwti_c5sjKUZFqwQ,23031
60
60
  pytgcalls/mtproto/mtproto_client.py,sha256=1C1Cc1GOrKom-70NqUOICKxjfjgpPZBSdKdwFUjZzBc,7616
61
- pytgcalls/mtproto/pyrogram_client.py,sha256=Z24edwj8wApTqECW5o5fF257fZhEIFvMw69uSULXlPU,23202
62
- pytgcalls/mtproto/telethon_client.py,sha256=U9FeII1-nmKCJlAekpAQ7Ljb9doHD0aFlKSbMjlszls,22440
61
+ pytgcalls/mtproto/pyrogram_client.py,sha256=GFt_2QoSEuRaIkUziZOnpBj8zEPiDGs55IriHU0jXwI,23213
62
+ pytgcalls/mtproto/telethon_client.py,sha256=L91_Zxud-pvtJy36fBi6daowNV2qPZHUEp5dcsu031I,22451
63
63
  pytgcalls/types/__init__.py,sha256=iXAzXG5WgbICLQV1JT_F4QtOqKWC8X3334-MOv2SXW4,1127
64
64
  pytgcalls/types/browsers.py,sha256=47Kr5q96n4Q4WvVhA6IUlS2egEcA9GRLlDeFcQYyc9M,9545
65
65
  pytgcalls/types/cache.py,sha256=FfsOcmYnsBGPlJoTPIXXYcUSpGE3rhx6cjIH77hyUL0,1059
@@ -91,7 +91,7 @@ pytgcalls/types/raw/video_stream.py,sha256=uE3jU9kJsrAoefXtDtEKNqTjcYGaQbZ1gbJ1S
91
91
  pytgcalls/types/stream/__init__.py,sha256=4CfgKXoEZX8BvV_ImBlY108MvRELNCf_-CPAMJ9szgk,561
92
92
  pytgcalls/types/stream/audio_quality.py,sha256=4X94ErmTeLP4TVcE3eLtPPdtluSPxgxbgTosuNJOVhc,141
93
93
  pytgcalls/types/stream/device.py,sha256=EdoDg6lPE7fgoZI04Nr0E9zbIk-iRIBgYYAzVqoCBPM,961
94
- pytgcalls/types/stream/direction.py,sha256=gd10wUmpfsqx87kCAPZt6u8pFiPb09WZfHKcMWAZokU,394
94
+ pytgcalls/types/stream/direction.py,sha256=VepLMe-dXg4M5eVdVyIb2uxYvnpB9OJL5fEgPYUFtTI,592
95
95
  pytgcalls/types/stream/external_media.py,sha256=RiuSX5tZGdNsQZ8LIRk5Lp4Ksv9oTvaccmInJRZYo4M,114
96
96
  pytgcalls/types/stream/frame.py,sha256=TXo5HZVHbbaVNBqulMhTqGODXH3bpBVlN_of1rosNUQ,586
97
97
  pytgcalls/types/stream/media_stream.py,sha256=jNWNJppX2ji4CrHdkF2b6FFLeiS9KKjVDGvcWPmPrvc,11917
@@ -99,8 +99,8 @@ pytgcalls/types/stream/record_stream.py,sha256=VEKB2rSnb4U1EyoPdNteWxJ65feV58EGu
99
99
  pytgcalls/types/stream/stream_ended.py,sha256=xR_kZwFf03hA6rw_nvI7Be7GwoCKzQf_1MKaGpPDXqY,716
100
100
  pytgcalls/types/stream/stream_frames.py,sha256=028ZhNV-mN3BGqMlmxusAV1xDQpXRYCeM0WXBZhRUhA,446
101
101
  pytgcalls/types/stream/video_quality.py,sha256=HBfWq005kh-D19MaVE9VzVdnODzrXf4IJUimCfslfiU,231
102
- py_tgcalls-2.1.0rc4.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
103
- py_tgcalls-2.1.0rc4.dist-info/METADATA,sha256=H6X5VamKCIuV6ApcU3YNwt8ADVD9FIdBKDxO7-VQA6M,14398
104
- py_tgcalls-2.1.0rc4.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
105
- py_tgcalls-2.1.0rc4.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
106
- py_tgcalls-2.1.0rc4.dist-info/RECORD,,
102
+ py_tgcalls-2.1.0rc5.dist-info/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
103
+ py_tgcalls-2.1.0rc5.dist-info/METADATA,sha256=8P8bWfrdmyEeRawMa2mgY62U8rgWRdp6x09fz4_2Jxo,14331
104
+ py_tgcalls-2.1.0rc5.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
105
+ py_tgcalls-2.1.0rc5.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
106
+ py_tgcalls-2.1.0rc5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.1.0.rc4'
1
+ __version__ = '2.1.0.rc5'
pytgcalls/exceptions.py CHANGED
@@ -186,3 +186,10 @@ class MTProtoClientNotConnected(Exception):
186
186
  super().__init__(
187
187
  'MTProto client not connected',
188
188
  )
189
+
190
+
191
+ class UnsupportedMethod(Exception):
192
+ def __init__(self):
193
+ super().__init__(
194
+ 'Unsupported method for this kind of call',
195
+ )
pytgcalls/filters.py CHANGED
@@ -137,6 +137,7 @@ async def _me_filter(_, client: PyTgCalls, u: Update):
137
137
  me = create(_me_filter)
138
138
 
139
139
 
140
+ # noinspection PyPep8Naming
140
141
  class stream_end(Filter):
141
142
  def __init__(
142
143
  self,
@@ -187,6 +188,7 @@ class chat_update(Filter):
187
188
  return False
188
189
 
189
190
 
191
+ # noinspection PyPep8Naming
190
192
  class call_participant(Filter):
191
193
  def __init__(self, flags: Optional[GroupCallParticipant.Action] = None):
192
194
  self.flags = flags
@@ -199,6 +201,7 @@ class call_participant(Filter):
199
201
  return False
200
202
 
201
203
 
204
+ # noinspection PyPep8Naming
202
205
  class stream_frame(Filter):
203
206
  def __init__(
204
207
  self,
@@ -14,7 +14,7 @@ class HandlersHolder:
14
14
  def __init__(self):
15
15
  self._callbacks = []
16
16
 
17
- async def propagate(
17
+ async def _propagate(
18
18
  self,
19
19
  update,
20
20
  client=None,
@@ -1,6 +1,7 @@
1
1
  from typing import Union
2
2
 
3
3
  from ...exceptions import NoActiveGroupCall
4
+ from ...exceptions import UnsupportedMethod
4
5
  from ...mtproto_required import mtproto_required
5
6
  from ...scaffold import Scaffold
6
7
  from ...statictypes import statictypes
@@ -15,6 +16,8 @@ class ChangeVolumeCall(Scaffold):
15
16
  volume: int,
16
17
  ):
17
18
  chat_id = await self.resolve_chat_id(chat_id)
19
+ if chat_id >= 0: # type: ignore
20
+ raise UnsupportedMethod()
18
21
  chat_call = await self._app.get_full_chat(
19
22
  chat_id,
20
23
  )
@@ -2,6 +2,7 @@ from typing import List
2
2
  from typing import Optional
3
3
  from typing import Union
4
4
 
5
+ from ...exceptions import UnsupportedMethod
5
6
  from ...mtproto_required import mtproto_required
6
7
  from ...scaffold import Scaffold
7
8
  from ...statictypes import statictypes
@@ -15,6 +16,9 @@ class GetParticipants(Scaffold):
15
16
  self,
16
17
  chat_id: Union[int, str],
17
18
  ) -> Optional[List[GroupCallParticipant]]:
19
+ chat_id = await self.resolve_chat_id(chat_id)
20
+ if chat_id >= 0: # type: ignore
21
+ raise UnsupportedMethod()
18
22
  return await self._app.get_group_call_participants(
19
- await self.resolve_chat_id(chat_id),
23
+ chat_id,
20
24
  )
@@ -1,21 +1,21 @@
1
- from .mute_stream import MuteStream
2
- from .pause_stream import PauseStream
1
+ from .mute import Mute
2
+ from .pause import Pause
3
3
  from .play import Play
4
4
  from .record import Record
5
- from .resume_stream import ResumeStream
5
+ from .resume import Resume
6
6
  from .send_frame import SendFrame
7
7
  from .time import Time
8
- from .unmute_stream import UnMuteStream
8
+ from .unmute import UnMute
9
9
 
10
10
 
11
11
  class StreamMethods(
12
- MuteStream,
13
- PauseStream,
12
+ Mute,
13
+ Pause,
14
14
  Play,
15
15
  Record,
16
16
  SendFrame,
17
17
  Time,
18
- ResumeStream,
19
- UnMuteStream,
18
+ Resume,
19
+ UnMute,
20
20
  ):
21
21
  pass
@@ -8,10 +8,10 @@ from ...scaffold import Scaffold
8
8
  from ...statictypes import statictypes
9
9
 
10
10
 
11
- class MuteStream(Scaffold):
11
+ class Mute(Scaffold):
12
12
  @statictypes
13
13
  @mtproto_required
14
- async def mute_stream(
14
+ async def mute(
15
15
  self,
16
16
  chat_id: Union[int, str],
17
17
  ):
@@ -8,10 +8,10 @@ from ...scaffold import Scaffold
8
8
  from ...statictypes import statictypes
9
9
 
10
10
 
11
- class PauseStream(Scaffold):
11
+ class Pause(Scaffold):
12
12
  @statictypes
13
13
  @mtproto_required
14
- async def pause_stream(
14
+ async def pause(
15
15
  self,
16
16
  chat_id: Union[int, str],
17
17
  ):
@@ -8,10 +8,10 @@ from ...scaffold import Scaffold
8
8
  from ...statictypes import statictypes
9
9
 
10
10
 
11
- class ResumeStream(Scaffold):
11
+ class Resume(Scaffold):
12
12
  @statictypes
13
13
  @mtproto_required
14
- async def resume_stream(
14
+ async def resume(
15
15
  self,
16
16
  chat_id: Union[int, str],
17
17
  ):
@@ -1,12 +1,12 @@
1
1
  from typing import Union
2
2
 
3
3
  from ntgcalls import ConnectionNotFound
4
- from ntgcalls import StreamMode
5
4
 
6
5
  from ...exceptions import NotInCallError
7
6
  from ...mtproto_required import mtproto_required
8
7
  from ...scaffold import Scaffold
9
8
  from ...statictypes import statictypes
9
+ from ...types import Direction
10
10
 
11
11
 
12
12
  class Time(Scaffold):
@@ -15,10 +15,10 @@ class Time(Scaffold):
15
15
  async def time(
16
16
  self,
17
17
  chat_id: Union[int, str],
18
- stream_mode: StreamMode = StreamMode.CAPTURE,
18
+ direction: Direction = Direction.OUTGOING,
19
19
  ):
20
20
  chat_id = await self.resolve_chat_id(chat_id)
21
21
  try:
22
- return await self._binding.time(chat_id, stream_mode)
22
+ return await self._binding.time(chat_id, direction.to_raw())
23
23
  except ConnectionNotFound:
24
24
  raise NotInCallError()
@@ -8,10 +8,10 @@ from ...scaffold import Scaffold
8
8
  from ...statictypes import statictypes
9
9
 
10
10
 
11
- class UnMuteStream(Scaffold):
11
+ class UnMute(Scaffold):
12
12
  @statictypes
13
13
  @mtproto_required
14
- async def unmute_stream(
14
+ async def unmute(
15
15
  self,
16
16
  chat_id: Union[int, str],
17
17
  ):
@@ -2,12 +2,12 @@ import asyncio
2
2
  import logging
3
3
  from typing import List
4
4
 
5
- from ntgcalls import CallNetworkState
6
5
  from ntgcalls import ConnectionError
7
6
  from ntgcalls import ConnectionNotFound
8
7
  from ntgcalls import ConnectionState
9
8
  from ntgcalls import Frame as RawFrame
10
9
  from ntgcalls import MediaState
10
+ from ntgcalls import NetworkInfo
11
11
  from ntgcalls import StreamDevice
12
12
  from ntgcalls import StreamMode
13
13
  from ntgcalls import StreamType
@@ -162,7 +162,7 @@ class Start(Scaffold):
162
162
  if is_self:
163
163
  if action == GroupCallParticipant.Action.LEFT:
164
164
  if await clear_call(chat_id):
165
- await self.propagate(
165
+ await self._propagate(
166
166
  ChatUpdate(
167
167
  chat_id,
168
168
  ChatUpdate.Status.KICKED,
@@ -190,7 +190,7 @@ class Start(Scaffold):
190
190
  else:
191
191
  self._need_unmute.discard(chat_id)
192
192
  if not isinstance(update, RawCallUpdate):
193
- await self.propagate(
193
+ await self._propagate(
194
194
  update,
195
195
  self,
196
196
  )
@@ -223,7 +223,7 @@ class Start(Scaffold):
223
223
  stream_type: StreamType,
224
224
  device: StreamDevice,
225
225
  ):
226
- await self.propagate(
226
+ await self._propagate(
227
227
  StreamEnded(
228
228
  chat_id,
229
229
  StreamEnded.Type.from_raw(stream_type),
@@ -247,7 +247,7 @@ class Start(Scaffold):
247
247
  device: StreamDevice,
248
248
  frames: List[RawFrame],
249
249
  ):
250
- await self.propagate(
250
+ await self._propagate(
251
251
  StreamFrames(
252
252
  chat_id,
253
253
  Direction.from_raw(mode),
@@ -270,7 +270,7 @@ class Start(Scaffold):
270
270
 
271
271
  async def connection_changed(
272
272
  chat_id: int,
273
- net_state: CallNetworkState,
273
+ net_state: NetworkInfo,
274
274
  ):
275
275
  state = net_state.connection_state
276
276
  if state == ConnectionState.CONNECTING:
@@ -89,7 +89,7 @@ class HydrogramClient(BridgedClient):
89
89
  ):
90
90
  user_id = self._cache.get_user_id(update.phone_call_id)
91
91
  if user_id is not None:
92
- await self.propagate(
92
+ await self._propagate(
93
93
  RawCallUpdate(
94
94
  user_id,
95
95
  RawCallUpdate.Type.SIGNALING_DATA,
@@ -113,7 +113,7 @@ class HydrogramClient(BridgedClient):
113
113
  ),
114
114
  )
115
115
  if isinstance(update.phone_call, PhoneCallAccepted):
116
- await self.propagate(
116
+ await self._propagate(
117
117
  RawCallUpdate(
118
118
  self.user_from_call(update.phone_call),
119
119
  RawCallUpdate.Type.ACCEPTED,
@@ -129,14 +129,14 @@ class HydrogramClient(BridgedClient):
129
129
  self._cache.drop_phone_call(
130
130
  user_id,
131
131
  )
132
- await self.propagate(
132
+ await self._propagate(
133
133
  ChatUpdate(
134
134
  user_id,
135
135
  ChatUpdate.Status.DISCARDED_CALL,
136
136
  ),
137
137
  )
138
138
  if isinstance(update.phone_call, PhoneCallRequested):
139
- await self.propagate(
139
+ await self._propagate(
140
140
  RawCallUpdate(
141
141
  self.user_from_call(update.phone_call),
142
142
  RawCallUpdate.Type.REQUESTED,
@@ -147,7 +147,7 @@ class HydrogramClient(BridgedClient):
147
147
  ),
148
148
  )
149
149
  if isinstance(update.phone_call, PhoneCall):
150
- await self.propagate(
150
+ await self._propagate(
151
151
  RawCallUpdate(
152
152
  self.user_from_call(update.phone_call),
153
153
  RawCallUpdate.Type.CONFIRMED,
@@ -174,7 +174,7 @@ class HydrogramClient(BridgedClient):
174
174
  self.parse_participant(participant),
175
175
  )
176
176
  if result is not None:
177
- await self.propagate(
177
+ await self._propagate(
178
178
  UpdatedGroupCallParticipant(
179
179
  self._cache.get_chat_id(update.call.id),
180
180
  result,
@@ -202,7 +202,7 @@ class HydrogramClient(BridgedClient):
202
202
  GroupCallDiscarded,
203
203
  ):
204
204
  self._cache.drop_cache(chat_id)
205
- await self.propagate(
205
+ await self._propagate(
206
206
  ChatUpdate(
207
207
  chat_id,
208
208
  ChatUpdate.Status.CLOSED_VOICE_CHAT,
@@ -219,7 +219,7 @@ class HydrogramClient(BridgedClient):
219
219
  ChannelForbidden,
220
220
  ):
221
221
  self._cache.drop_cache(chat_id)
222
- await self.propagate(
222
+ await self._propagate(
223
223
  ChatUpdate(
224
224
  chat_id,
225
225
  ChatUpdate.Status.KICKED,
@@ -242,7 +242,7 @@ class HydrogramClient(BridgedClient):
242
242
  update.message.peer_id,
243
243
  PeerChat,
244
244
  ):
245
- await self.propagate(
245
+ await self._propagate(
246
246
  ChatUpdate(
247
247
  chat_id,
248
248
  ChatUpdate.Status.INVITED_VOICE_CHAT,
@@ -262,7 +262,7 @@ class HydrogramClient(BridgedClient):
262
262
  ChatForbidden,
263
263
  ):
264
264
  self._cache.drop_cache(chat_id)
265
- await self.propagate(
265
+ await self._propagate(
266
266
  ChatUpdate(
267
267
  chat_id,
268
268
  ChatUpdate.Status.KICKED,
@@ -290,7 +290,7 @@ class HydrogramClient(BridgedClient):
290
290
  self._cache.drop_cache(
291
291
  chat_id,
292
292
  )
293
- await self.propagate(
293
+ await self._propagate(
294
294
  ChatUpdate(
295
295
  chat_id,
296
296
  ChatUpdate.Status.LEFT_GROUP,
@@ -97,7 +97,7 @@ class PyrogramClient(BridgedClient):
97
97
  ):
98
98
  user_id = self._cache.get_user_id(update.phone_call_id)
99
99
  if user_id is not None:
100
- await self.propagate(
100
+ await self._propagate(
101
101
  RawCallUpdate(
102
102
  user_id,
103
103
  RawCallUpdate.Type.SIGNALING_DATA,
@@ -121,7 +121,7 @@ class PyrogramClient(BridgedClient):
121
121
  ),
122
122
  )
123
123
  if isinstance(update.phone_call, PhoneCallAccepted):
124
- await self.propagate(
124
+ await self._propagate(
125
125
  RawCallUpdate(
126
126
  self.user_from_call(update.phone_call),
127
127
  RawCallUpdate.Type.ACCEPTED,
@@ -137,14 +137,14 @@ class PyrogramClient(BridgedClient):
137
137
  self._cache.drop_phone_call(
138
138
  user_id,
139
139
  )
140
- await self.propagate(
140
+ await self._propagate(
141
141
  ChatUpdate(
142
142
  user_id,
143
143
  ChatUpdate.Status.DISCARDED_CALL,
144
144
  ),
145
145
  )
146
146
  if isinstance(update.phone_call, PhoneCallRequested):
147
- await self.propagate(
147
+ await self._propagate(
148
148
  RawCallUpdate(
149
149
  self.user_from_call(update.phone_call),
150
150
  RawCallUpdate.Type.REQUESTED,
@@ -155,7 +155,7 @@ class PyrogramClient(BridgedClient):
155
155
  ),
156
156
  )
157
157
  if isinstance(update.phone_call, PhoneCall):
158
- await self.propagate(
158
+ await self._propagate(
159
159
  RawCallUpdate(
160
160
  self.user_from_call(update.phone_call),
161
161
  RawCallUpdate.Type.CONFIRMED,
@@ -182,7 +182,7 @@ class PyrogramClient(BridgedClient):
182
182
  self.parse_participant(participant),
183
183
  )
184
184
  if result is not None:
185
- await self.propagate(
185
+ await self._propagate(
186
186
  UpdatedGroupCallParticipant(
187
187
  self._cache.get_chat_id(update.call.id),
188
188
  result,
@@ -210,7 +210,7 @@ class PyrogramClient(BridgedClient):
210
210
  GroupCallDiscarded,
211
211
  ):
212
212
  self._cache.drop_cache(chat_id)
213
- await self.propagate(
213
+ await self._propagate(
214
214
  ChatUpdate(
215
215
  chat_id,
216
216
  ChatUpdate.Status.CLOSED_VOICE_CHAT,
@@ -227,7 +227,7 @@ class PyrogramClient(BridgedClient):
227
227
  ChannelForbidden,
228
228
  ):
229
229
  self._cache.drop_cache(chat_id)
230
- await self.propagate(
230
+ await self._propagate(
231
231
  ChatUpdate(
232
232
  chat_id,
233
233
  ChatUpdate.Status.KICKED,
@@ -250,7 +250,7 @@ class PyrogramClient(BridgedClient):
250
250
  update.message.peer_id,
251
251
  PeerChat,
252
252
  ):
253
- await self.propagate(
253
+ await self._propagate(
254
254
  ChatUpdate(
255
255
  chat_id,
256
256
  ChatUpdate.Status.INVITED_VOICE_CHAT,
@@ -270,7 +270,7 @@ class PyrogramClient(BridgedClient):
270
270
  ChatForbidden,
271
271
  ):
272
272
  self._cache.drop_cache(chat_id)
273
- await self.propagate(
273
+ await self._propagate(
274
274
  ChatUpdate(
275
275
  chat_id,
276
276
  ChatUpdate.Status.KICKED,
@@ -298,7 +298,7 @@ class PyrogramClient(BridgedClient):
298
298
  self._cache.drop_cache(
299
299
  chat_id,
300
300
  )
301
- await self.propagate(
301
+ await self._propagate(
302
302
  ChatUpdate(
303
303
  chat_id,
304
304
  ChatUpdate.Status.LEFT_GROUP,
@@ -88,7 +88,7 @@ class TelethonClient(BridgedClient):
88
88
  ):
89
89
  user_id = self._cache.get_user_id(update.phone_call_id)
90
90
  if user_id is not None:
91
- await self.propagate(
91
+ await self._propagate(
92
92
  RawCallUpdate(
93
93
  user_id,
94
94
  RawCallUpdate.Type.SIGNALING_DATA,
@@ -112,7 +112,7 @@ class TelethonClient(BridgedClient):
112
112
  ),
113
113
  )
114
114
  if isinstance(update.phone_call, PhoneCallAccepted):
115
- await self.propagate(
115
+ await self._propagate(
116
116
  RawCallUpdate(
117
117
  self.user_from_call(update.phone_call),
118
118
  RawCallUpdate.Type.ACCEPTED,
@@ -128,14 +128,14 @@ class TelethonClient(BridgedClient):
128
128
  self._cache.drop_phone_call(
129
129
  user_id,
130
130
  )
131
- await self.propagate(
131
+ await self._propagate(
132
132
  ChatUpdate(
133
133
  user_id,
134
134
  ChatUpdate.Status.DISCARDED_CALL,
135
135
  ),
136
136
  )
137
137
  if isinstance(update.phone_call, PhoneCallRequested):
138
- await self.propagate(
138
+ await self._propagate(
139
139
  RawCallUpdate(
140
140
  self.user_from_call(update.phone_call),
141
141
  RawCallUpdate.Type.REQUESTED,
@@ -146,7 +146,7 @@ class TelethonClient(BridgedClient):
146
146
  ),
147
147
  )
148
148
  if isinstance(update.phone_call, PhoneCall):
149
- await self.propagate(
149
+ await self._propagate(
150
150
  RawCallUpdate(
151
151
  self.user_from_call(update.phone_call),
152
152
  RawCallUpdate.Type.CONFIRMED,
@@ -173,7 +173,7 @@ class TelethonClient(BridgedClient):
173
173
  self.parse_participant(participant),
174
174
  )
175
175
  if result is not None:
176
- await self.propagate(
176
+ await self._propagate(
177
177
  UpdatedGroupCallParticipant(
178
178
  self._cache.get_chat_id(update.call.id),
179
179
  result,
@@ -207,7 +207,7 @@ class TelethonClient(BridgedClient):
207
207
  self._cache.drop_cache(
208
208
  chat_id,
209
209
  )
210
- await self.propagate(
210
+ await self._propagate(
211
211
  ChatUpdate(
212
212
  chat_id,
213
213
  ChatUpdate.Status.CLOSED_VOICE_CHAT,
@@ -224,7 +224,7 @@ class TelethonClient(BridgedClient):
224
224
  )
225
225
  except ChannelPrivateError:
226
226
  self._cache.drop_cache(chat_id)
227
- await self.propagate(
227
+ await self._propagate(
228
228
  ChatUpdate(
229
229
  chat_id,
230
230
  ChatUpdate.Status.KICKED,
@@ -244,7 +244,7 @@ class TelethonClient(BridgedClient):
244
244
  update.message.action,
245
245
  MessageActionInviteToGroupCall,
246
246
  ):
247
- await self.propagate(
247
+ await self._propagate(
248
248
  ChatUpdate(
249
249
  chat_id,
250
250
  ChatUpdate.Status.INVITED_VOICE_CHAT,
@@ -254,7 +254,7 @@ class TelethonClient(BridgedClient):
254
254
  if isinstance(update.message.out, bool):
255
255
  if update.message.out:
256
256
  self._cache.drop_cache(chat_id)
257
- await self.propagate(
257
+ await self._propagate(
258
258
  ChatUpdate(
259
259
  chat_id,
260
260
  ChatUpdate.Status.LEFT_GROUP,
@@ -273,7 +273,7 @@ class TelethonClient(BridgedClient):
273
273
  ChatForbidden,
274
274
  ):
275
275
  self._cache.drop_cache(chat_id)
276
- await self.propagate(
276
+ await self._propagate(
277
277
  ChatUpdate(
278
278
  chat_id,
279
279
  ChatUpdate.Status.KICKED,
@@ -16,3 +16,10 @@ class Direction(Flag):
16
16
  if direction == StreamMode.PLAYBACK:
17
17
  return Direction.INCOMING
18
18
  return None
19
+
20
+ def to_raw(self):
21
+ if self is Direction.OUTGOING:
22
+ return StreamMode.CAPTURE
23
+ if self is Direction.INCOMING:
24
+ return StreamMode.PLAYBACK
25
+ return None