py-tgcalls 2.2.6__py3-none-any.whl → 2.2.8__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.6
3
+ Version: 2.2.8
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/
@@ -1,10 +1,10 @@
1
- py_tgcalls-2.2.6.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
1
+ py_tgcalls-2.2.8.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
2
2
  pytgcalls/__init__.py,sha256=qbfwN7rYwIdCegMOzdcbvwazeNjDzgmowgcqLFNqKIM,308
3
- pytgcalls/__version__.py,sha256=ki8CvreWdC_q66zVTHoUGjT2EI8obe9OHjOQcNZfOfM,22
3
+ pytgcalls/__version__.py,sha256=IqD9h-jsDDriviuNsOqmA0rXPSWRSWW_V-IX7uKeRnk,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
7
- pytgcalls/ffmpeg.py,sha256=CZvSyuztc-TGKbKI9_2G7CLITe1ITf315YPyprWu_Pg,8645
7
+ pytgcalls/ffmpeg.py,sha256=DkP-Xj9O1sohGR8TjIcCbv-oYJjnkGKYxhu7Sg6V0KY,8645
8
8
  pytgcalls/filters.py,sha256=8Fq_gvHHdqhIk_XwMJ9wneeZOwrvBkSOKaMJ60r3bZU,6157
9
9
  pytgcalls/list_to_cmd.py,sha256=rGJLsejbAQdDb8pctMbLnwea5NkitlfVKc3IpoGi4V4,240
10
10
  pytgcalls/mtproto_required.py,sha256=6B-31p5qH_6oekUgypV4nK3hqPS6Nr-pA8S81wjnbaY,630
@@ -71,12 +71,12 @@ pytgcalls/methods/utilities/run.py,sha256=cnYQd2xB5Cr_WS0Q2cXJZPGiN6JOCULzj1r4xX
71
71
  pytgcalls/methods/utilities/start.py,sha256=mn0kQZhTUuc-9CCJDbFIVsEtJ8kfnfZOGbVC505qVRM,3232
72
72
  pytgcalls/methods/utilities/stream_params.py,sha256=PUnctLhdCeBAg52v95vpxj-42Le5XzbnRtcfm71FDBM,3341
73
73
  pytgcalls/mtproto/__init__.py,sha256=X4zvzFG7km7qHyE0fdvA550WcOVO_xl_p__gvIfDGmw,130
74
- pytgcalls/mtproto/bridged_client.py,sha256=Qb9-9FrUdh3g_sx-JOcvkzv3kJtS_pz2Qaos85DgVPI,8280
74
+ pytgcalls/mtproto/bridged_client.py,sha256=E0DLhZd-x7Uxyf6nFaTZ73COLB6BnXHzsBgqwWGHwEQ,8476
75
75
  pytgcalls/mtproto/client_cache.py,sha256=5unu8sjLRaIKoEgJGaIRjhA4P3U2lFpfakTKFxKLzAM,5591
76
- pytgcalls/mtproto/hydrogram_client.py,sha256=R0VsYhesIhvXeEi0qI-BdQSDE9fBpjFp7j8EI6B8Y4U,29419
76
+ pytgcalls/mtproto/hydrogram_client.py,sha256=ocypZa8uH3VvSmgWE8I5rAvFs4VJ3yBphPXghB1vZyI,30019
77
77
  pytgcalls/mtproto/mtproto_client.py,sha256=9SIG3DNeICIXvggyVE8DQWtToPtxV0t9ZKr6dEMnEMg,8783
78
- pytgcalls/mtproto/pyrogram_client.py,sha256=-n40vFJ9vWESiLNGQSrMudRkduwbi1250wGZDnIKqWo,29415
79
- pytgcalls/mtproto/telethon_client.py,sha256=DbHyBpLKd0XxxfEK9Yc0WXfRCTsJNCyD0YveexaT018,27561
78
+ pytgcalls/mtproto/pyrogram_client.py,sha256=iyygyyh7pN0xCqLF50fA48lgLsucw7awogWCd5tOmLc,30005
79
+ pytgcalls/mtproto/telethon_client.py,sha256=DHtGbSqqjMMqrIyDKWdrK3NUoWX3i_tYQm9oYJQ1-vA,28172
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.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,,
120
+ py_tgcalls-2.2.8.dist-info/METADATA,sha256=ES6Bwhsvi1yPMrVGm9cW03FNWRCtW-fuzQApJVLBPeQ,5280
121
+ py_tgcalls-2.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
122
+ py_tgcalls-2.2.8.dist-info/top_level.txt,sha256=IUDUwn0KkcbUYZbCe9R5AUb2Ob-lmllNUGQqyeXXd8A,10
123
+ py_tgcalls-2.2.8.dist-info/RECORD,,
pytgcalls/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '2.2.6'
1
+ __version__ = '2.2.8'
pytgcalls/ffmpeg.py CHANGED
@@ -63,7 +63,7 @@ async def check_stream(
63
63
  raise
64
64
 
65
65
  have_video = False
66
- is_image = False
66
+ is_image = True
67
67
  have_audio = False
68
68
  have_valid_video = False
69
69
 
@@ -107,7 +107,7 @@ async def check_stream(
107
107
  stream_parameters.height = new_h
108
108
  stream_parameters.width = new_w
109
109
  if is_image:
110
- stream_parameters.frame_rate = 1
110
+ stream_parameters.frame_rate = 10
111
111
  raise ImageSourceFound(path)
112
112
 
113
113
  if isinstance(stream_parameters, AudioParameters) and not have_audio:
@@ -248,18 +248,20 @@ class BridgedClient(HandlersHolder):
248
248
  return GroupCallParticipant.Action.UPDATED
249
249
 
250
250
  @staticmethod
251
- def chat_id(input_peer) -> int:
251
+ def chat_id(input_peer, readable: bool = True) -> int:
252
252
  class_name = input_peer.__class__.__name__
253
253
  if class_name in ['PeerUser', 'InputPeerUser']:
254
254
  return input_peer.user_id
255
255
  elif class_name in ['Channel', 'ChannelForbidden']:
256
- return -1000000000000 - input_peer.id
256
+ return -1000000000000 - input_peer.id \
257
+ if readable else input_peer.id
257
258
  elif hasattr(input_peer, 'channel_id'):
258
- return -1000000000000 - input_peer.channel_id
259
+ return -1000000000000 - input_peer.channel_id \
260
+ if readable else input_peer.channel_id
259
261
  elif class_name == 'Chat':
260
- return -input_peer.id
262
+ return -input_peer.id if readable else input_peer.id
261
263
  else:
262
- return -input_peer.chat_id
264
+ return -input_peer.chat_id if readable else input_peer.chat_id
263
265
 
264
266
  @staticmethod
265
267
  def user_from_call(call) -> Optional[int]:
@@ -10,6 +10,7 @@ from hydrogram.errors import AuthBytesInvalid
10
10
  from hydrogram.errors import BadRequest
11
11
  from hydrogram.errors import FileMigrate
12
12
  from hydrogram.errors import FloodWait
13
+ from hydrogram.errors.exceptions import GroupcallForbidden
13
14
  from hydrogram.raw.base import InputPeer
14
15
  from hydrogram.raw.base import InputUser
15
16
  from hydrogram.raw.functions.auth import ExportAuthorization
@@ -59,6 +60,7 @@ from hydrogram.raw.types import PhoneCallProtocol
59
60
  from hydrogram.raw.types import PhoneCallRequested
60
61
  from hydrogram.raw.types import PhoneCallWaiting
61
62
  from hydrogram.raw.types import UpdateChannel
63
+ from hydrogram.raw.types import UpdateChat
62
64
  from hydrogram.raw.types import UpdateGroupCall
63
65
  from hydrogram.raw.types import UpdateGroupCallConnection
64
66
  from hydrogram.raw.types import UpdateGroupCallParticipants
@@ -70,9 +72,9 @@ from hydrogram.raw.types import Updates
70
72
  from hydrogram.raw.types.messages import DhConfig
71
73
  from hydrogram.session import Auth
72
74
  from hydrogram.session import Session
75
+ from hydrogram.types import PeerChannel
73
76
  from ntgcalls import MediaSegmentQuality
74
77
  from ntgcalls import Protocol
75
- from pyrogram.errors import GroupcallForbidden
76
78
 
77
79
  from ..types import CallProtocol
78
80
  from ..types import ChatUpdate
@@ -233,13 +235,21 @@ class HydrogramClient(BridgedClient):
233
235
  )
234
236
  if isinstance(
235
237
  update,
236
- UpdateChannel,
238
+ (
239
+ UpdateChannel,
240
+ UpdateChat,
241
+ ),
237
242
  ):
238
243
  chat_id = self.chat_id(update)
239
244
  if len(chats) > 0:
240
245
  if isinstance(
241
- chats[update.channel_id],
242
- ChannelForbidden,
246
+ chats[
247
+ self.chat_id(
248
+ update,
249
+ False,
250
+ )
251
+ ],
252
+ (ChannelForbidden, ChatForbidden),
243
253
  ):
244
254
  self._cache.drop_cache(chat_id)
245
255
  await self._propagate(
@@ -261,28 +271,36 @@ class HydrogramClient(BridgedClient):
261
271
  update.message.action,
262
272
  MessageActionInviteToGroupCall,
263
273
  ):
264
- if isinstance(
265
- update.message.peer_id,
266
- PeerChat,
267
- ):
268
- await self._propagate(
269
- ChatUpdate(
270
- chat_id,
271
- ChatUpdate.Status.INVITED_VOICE_CHAT,
272
- update.message.action,
273
- ),
274
- )
274
+ await self._propagate(
275
+ ChatUpdate(
276
+ chat_id,
277
+ ChatUpdate.Status.INVITED_VOICE_CHAT,
278
+ update.message.action,
279
+ ),
280
+ )
281
+
275
282
  if isinstance(
276
283
  update.message.action,
277
284
  MessageActionChatDeleteUser,
278
285
  ):
279
286
  if isinstance(
280
287
  update.message.peer_id,
281
- PeerChat,
288
+ (
289
+ PeerChat,
290
+ PeerChannel,
291
+ ),
282
292
  ):
283
293
  if isinstance(
284
- chats[update.message.peer_id.chat_id],
285
- ChatForbidden,
294
+ chats[
295
+ self.chat_id(
296
+ update.message.peer_id,
297
+ False,
298
+ )
299
+ ],
300
+ (
301
+ ChatForbidden,
302
+ ChannelForbidden,
303
+ ),
286
304
  ):
287
305
  self._cache.drop_cache(chat_id)
288
306
  await self._propagate(
@@ -51,6 +51,7 @@ from pyrogram.raw.types import InputPhoneCall
51
51
  from pyrogram.raw.types import MessageActionChatDeleteUser
52
52
  from pyrogram.raw.types import MessageActionInviteToGroupCall
53
53
  from pyrogram.raw.types import MessageService
54
+ from pyrogram.raw.types import PeerChannel
54
55
  from pyrogram.raw.types import PeerChat
55
56
  from pyrogram.raw.types import PhoneCall
56
57
  from pyrogram.raw.types import PhoneCallAccepted
@@ -62,6 +63,7 @@ from pyrogram.raw.types import PhoneCallProtocol
62
63
  from pyrogram.raw.types import PhoneCallRequested
63
64
  from pyrogram.raw.types import PhoneCallWaiting
64
65
  from pyrogram.raw.types import UpdateChannel
66
+ from pyrogram.raw.types import UpdateChat
65
67
  from pyrogram.raw.types import UpdateGroupCall
66
68
  from pyrogram.raw.types import UpdateGroupCallConnection
67
69
  from pyrogram.raw.types import UpdateGroupCallParticipants
@@ -234,13 +236,21 @@ class PyrogramClient(BridgedClient):
234
236
  )
235
237
  if isinstance(
236
238
  update,
237
- UpdateChannel,
239
+ (
240
+ UpdateChannel,
241
+ UpdateChat,
242
+ ),
238
243
  ):
239
244
  chat_id = self.chat_id(update)
240
245
  if len(chats) > 0:
241
246
  if isinstance(
242
- chats[update.channel_id],
243
- ChannelForbidden,
247
+ chats[
248
+ self.chat_id(
249
+ update,
250
+ False,
251
+ )
252
+ ],
253
+ (ChannelForbidden, ChatForbidden),
244
254
  ):
245
255
  self._cache.drop_cache(chat_id)
246
256
  await self._propagate(
@@ -262,28 +272,36 @@ class PyrogramClient(BridgedClient):
262
272
  update.message.action,
263
273
  MessageActionInviteToGroupCall,
264
274
  ):
265
- if isinstance(
266
- update.message.peer_id,
267
- PeerChat,
268
- ):
269
- await self._propagate(
270
- ChatUpdate(
271
- chat_id,
272
- ChatUpdate.Status.INVITED_VOICE_CHAT,
273
- update.message.action,
274
- ),
275
- )
275
+ await self._propagate(
276
+ ChatUpdate(
277
+ chat_id,
278
+ ChatUpdate.Status.INVITED_VOICE_CHAT,
279
+ update.message.action,
280
+ ),
281
+ )
282
+
276
283
  if isinstance(
277
284
  update.message.action,
278
285
  MessageActionChatDeleteUser,
279
286
  ):
280
287
  if isinstance(
281
288
  update.message.peer_id,
282
- PeerChat,
289
+ (
290
+ PeerChat,
291
+ PeerChannel,
292
+ ),
283
293
  ):
284
294
  if isinstance(
285
- chats[update.message.peer_id.chat_id],
286
- ChatForbidden,
295
+ chats[
296
+ self.chat_id(
297
+ update.message.peer_id,
298
+ False,
299
+ )
300
+ ],
301
+ (
302
+ ChatForbidden,
303
+ ChannelForbidden,
304
+ ),
287
305
  ):
288
306
  self._cache.drop_cache(chat_id)
289
307
  await self._propagate(
@@ -8,6 +8,7 @@ from ntgcalls import Protocol
8
8
  from telethon import TelegramClient
9
9
  from telethon.errors import BadRequestError
10
10
  from telethon.errors import ChannelPrivateError
11
+ from telethon.errors import ChatForbiddenError
11
12
  from telethon.errors import FileMigrateError
12
13
  from telethon.errors import FloodWaitError
13
14
  from telethon.errors import GroupcallForbiddenError
@@ -31,6 +32,7 @@ from telethon.tl.functions.phone import LeaveGroupCallRequest
31
32
  from telethon.tl.functions.phone import RequestCallRequest
32
33
  from telethon.tl.functions.phone import SendSignalingDataRequest
33
34
  from telethon.tl.functions.upload import GetFileRequest
35
+ from telethon.tl.types import ChannelForbidden
34
36
  from telethon.tl.types import ChatForbidden
35
37
  from telethon.tl.types import DataJSON
36
38
  from telethon.tl.types import GroupCall
@@ -58,6 +60,7 @@ from telethon.tl.types import TypeInputChannel
58
60
  from telethon.tl.types import TypeInputPeer
59
61
  from telethon.tl.types import TypeInputUser
60
62
  from telethon.tl.types import UpdateChannel
63
+ from telethon.tl.types import UpdateChat
61
64
  from telethon.tl.types import UpdateGroupCall
62
65
  from telethon.tl.types import UpdateGroupCallConnection
63
66
  from telethon.tl.types import UpdateGroupCallParticipants
@@ -233,14 +236,19 @@ class TelethonClient(BridgedClient):
233
236
  )
234
237
  if isinstance(
235
238
  update,
236
- UpdateChannel,
239
+ (
240
+ UpdateChannel,
241
+ UpdateChat,
242
+ ),
237
243
  ):
238
244
  chat_id = self.chat_id(update)
239
245
  try:
240
246
  await self._app.get_entity(
241
- PeerChannel(chat_id),
247
+ PeerChannel(chat_id)
248
+ if isinstance(update, UpdateChannel)
249
+ else PeerChat(chat_id),
242
250
  )
243
- except ChannelPrivateError:
251
+ except (ChannelPrivateError, ChatForbiddenError):
244
252
  self._cache.drop_cache(chat_id)
245
253
  await self._propagate(
246
254
  ChatUpdate(
@@ -269,26 +277,32 @@ class TelethonClient(BridgedClient):
269
277
  update.message.action,
270
278
  ),
271
279
  )
272
- if isinstance(update.message.out, bool):
273
- if update.message.out:
274
- self._cache.drop_cache(chat_id)
275
- await self._propagate(
276
- ChatUpdate(
277
- chat_id,
278
- ChatUpdate.Status.LEFT_GROUP,
279
- ),
280
- )
281
280
  if isinstance(
282
281
  update.message.action,
283
282
  MessageActionChatDeleteUser,
284
283
  ):
284
+ if isinstance(update.message.out, bool):
285
+ if update.message.out:
286
+ self._cache.drop_cache(chat_id)
287
+ await self._propagate(
288
+ ChatUpdate(
289
+ chat_id,
290
+ ChatUpdate.Status.LEFT_GROUP,
291
+ ),
292
+ )
285
293
  if isinstance(
286
294
  update.message.peer_id,
287
- PeerChat,
295
+ (
296
+ PeerChat,
297
+ PeerChannel,
298
+ ),
288
299
  ):
289
300
  if isinstance(
290
301
  await self._app.get_entity(chat_id),
291
- ChatForbidden,
302
+ (
303
+ ChatForbidden,
304
+ ChannelForbidden,
305
+ ),
292
306
  ):
293
307
  self._cache.drop_cache(chat_id)
294
308
  await self._propagate(