pyrogrammod 2.1.2__py3-none-any.whl → 2.1.4__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.
pyrogram/__init__.py CHANGED
@@ -16,7 +16,7 @@
16
16
  # You should have received a copy of the GNU Lesser General Public License
17
17
  # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18
18
 
19
- __version__ = "2.1.2"
19
+ __version__ = "2.1.4"
20
20
  __license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
21
21
  __copyright__ = "Copyright (C) 2017-present Dan <https://github.com/delivrance>"
22
22
 
pyrogram/client.py CHANGED
@@ -48,9 +48,13 @@ from pyrogram.errors import CDNFileHashMismatch, AuthBytesInvalid, ChannelInvali
48
48
  from pyrogram.errors import (
49
49
  SessionPasswordNeeded,
50
50
  VolumeLocNotFound, ChannelPrivate,
51
- BadRequest,
52
- FloodWait,
53
- FloodPremiumWait
51
+ BadRequest,
52
+ AuthBytesInvalid,
53
+ FloodWait,
54
+ FloodPremiumWait,
55
+ ChannelInvalid,
56
+ PersistentTimestampInvalid,
57
+ PersistentTimestampOutdated
54
58
  )
55
59
  from pyrogram.handlers.handler import Handler
56
60
  from pyrogram.methods import Methods
@@ -616,10 +620,11 @@ class Client(Methods):
616
620
  )]
617
621
  ),
618
622
  pts=pts - pts_count,
619
- limit=pts
623
+ limit=pts,
624
+ force=False
620
625
  )
621
626
  )
622
- except ChannelPrivate:
627
+ except (ChannelPrivate, PersistentTimestampOutdated, PersistentTimestampInvalid):
623
628
  pass
624
629
  else:
625
630
  if not isinstance(diff, raw.types.updates.ChannelDifferenceEmpty):
pyrogram/filters.py CHANGED
@@ -458,8 +458,12 @@ media_spoiler = create(media_spoiler_filter)
458
458
  # endregion
459
459
 
460
460
  # region private_filter
461
- async def private_filter(_, __, m: Message):
462
- m = m.message if isinstance(m, CallbackQuery) else m
461
+ async def private_filter(_, __, m: Union[Message, CallbackQuery]) -> bool:
462
+ m = getattr(m, "message", None) if isinstance(m, CallbackQuery) else m
463
+ if not m:
464
+ raise ValueError(
465
+ "filters.private is not supported here "
466
+ )
463
467
  return bool(m.chat and m.chat.type in {enums.ChatType.PRIVATE, enums.ChatType.BOT})
464
468
 
465
469
 
@@ -128,7 +128,7 @@ class SaveFile:
128
128
  if file_size == 0:
129
129
  raise ValueError("File size equals to 0 B")
130
130
 
131
- file_size_limit_mib = 4000 if self.me.is_premium else 2000
131
+ file_size_limit_mib = 4000 if self.me and self.me.is_premium else 2000
132
132
 
133
133
  if file_size > file_size_limit_mib * 1024 * 1024:
134
134
  raise ValueError(f"Can't upload files bigger than {file_size_limit_mib} MiB")
@@ -39,6 +39,10 @@ class Reaction(Object):
39
39
  chosen_order (``int``, *optional*):
40
40
  Chosen reaction order.
41
41
  Available for chosen reactions.
42
+
43
+ is_paid (``bool``, *optional*):
44
+ True, if this is a paid reaction.
45
+
42
46
  """
43
47
 
44
48
  def __init__(
@@ -48,7 +52,8 @@ class Reaction(Object):
48
52
  emoji: Optional[str] = None,
49
53
  custom_emoji_id: Optional[int] = None,
50
54
  count: Optional[int] = None,
51
- chosen_order: Optional[int] = None
55
+ chosen_order: Optional[int] = None,
56
+ is_paid: Optional[bool] = None
52
57
  ):
53
58
  super().__init__(client)
54
59
 
@@ -56,12 +61,13 @@ class Reaction(Object):
56
61
  self.custom_emoji_id = custom_emoji_id
57
62
  self.count = count
58
63
  self.chosen_order = chosen_order
64
+ self.is_paid = is_paid
59
65
 
60
66
  @staticmethod
61
67
  def _parse(
62
68
  client: "pyrogram.Client",
63
69
  reaction: "raw.base.Reaction"
64
- ) -> "Reaction":
70
+ ) -> Optional["Reaction"]:
65
71
  if isinstance(reaction, raw.types.ReactionEmoji):
66
72
  return Reaction(
67
73
  client=client,
@@ -74,13 +80,25 @@ class Reaction(Object):
74
80
  custom_emoji_id=reaction.document_id
75
81
  )
76
82
 
83
+ if isinstance(reaction, raw.types.ReactionPaid):
84
+ return Reaction(
85
+ client=client,
86
+ is_paid=True
87
+ )
88
+
89
+ return None
90
+
77
91
  @staticmethod
78
92
  def _parse_count(
79
93
  client: "pyrogram.Client",
80
- reaction_count: "raw.base.ReactionCount"
81
- ) -> "Reaction":
94
+ reaction_count: Optional["raw.base.ReactionCount"]
95
+ ) -> Optional["Reaction"]:
96
+ if not reaction_count:
97
+ return None
98
+
82
99
  reaction = Reaction._parse(client, reaction_count.reaction)
83
- reaction.count = reaction_count.count
84
- reaction.chosen_order = reaction_count.chosen_order
100
+ if reaction:
101
+ reaction.count = reaction_count.count if reaction_count else 0
102
+ reaction.chosen_order = reaction_count.chosen_order
85
103
 
86
104
  return reaction
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyrogrammod
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: Modified version of the Pyrogram Telegram MTProto API framework in Python for users and bots.
5
5
  Home-page: https://github.com/PyrogramMod/PyrogramMod
6
6
  Download-URL: https://github.com/PyrogramMod/PyrogramMod/releases/latest
@@ -62,7 +62,7 @@ Requires-Dist: aiofiles
62
62
  </a>
63
63
  </p>
64
64
 
65
- ## Pyrogram
65
+ # PyrogramMod <br>[![PyPI](https://img.shields.io/pypi/v/pyrogrammod.svg?logo=python&logoColor=%23959DA5&label=pypi&labelColor=%23282f37)](https://pypi.org/project/pyrogrammod/) [![Downloads](https://pepy.tech/badge/pyrogrammod)](https://pepy.tech/project/pyrogrammod)
66
66
 
67
67
  > Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots
68
68
 
@@ -1,9 +1,9 @@
1
- pyrogram/__init__.py,sha256=9LosOIsUWyGIheL7EdgM7C_c4k-B-d5i79MKrOveFK8,1399
2
- pyrogram/client.py,sha256=LBTP_ZN5dJkw-ft0-cls4lMxav5E1xqFLFx2OuvQMTU,49730
1
+ pyrogram/__init__.py,sha256=T83zzGtXUbwLaxFO0Bi1t6BOUPED5dSPptir2NcqMdM,1399
2
+ pyrogram/client.py,sha256=lN7hFqvtzzaPB6Kr7imumb2LRaVt7LhPTP6QTz5vewo,49949
3
3
  pyrogram/dispatcher.py,sha256=yWshlu3R24vNwYMEzibC-mYOwr3JCu9HG9XTFksXGj4,10149
4
4
  pyrogram/emoji.py,sha256=ixb3OXR1XpLf3BQpw8kWIpmbQRowRIaFedjdnuzljac,208021
5
5
  pyrogram/file_id.py,sha256=jmMBAt2O_XhLE_AXKffZ4F5gccXJB8GHV7MlFCpiklA,15154
6
- pyrogram/filters.py,sha256=BH9Jj_2EQMQNJrxfkGUw--19RtEFaCE_APwanJHXx0M,25396
6
+ pyrogram/filters.py,sha256=SRsirpb0Dqv0dgPHKpsG0uAa4NRDPDTp1laod3dY8dA,25547
7
7
  pyrogram/mime_types.py,sha256=JbYF6B-JrxZQNga8dPz2C8Dwp8-2pOrE1uv3KIBbjA0,61915
8
8
  pyrogram/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  pyrogram/sync.py,sha256=cxKmLz9NAJPX2N2n2CogTLXyNo-dWgf6etBRXnqq1XA,3739
@@ -69,7 +69,7 @@ pyrogram/methods/__init__.py,sha256=6PpIkjIGLQ_e50nySmI2yjLPym5TGz1YIkHFRUQg_qg,
69
69
  pyrogram/methods/advanced/__init__.py,sha256=nRNLZaThEQylTXtzEbPoQz0s4A5GcJrH7C_dwKKJ530,988
70
70
  pyrogram/methods/advanced/invoke.py,sha256=cduAX4lBhqJ6GF6psrwEw3uRFnnEggk_fuyeD3Nmbo4,3133
71
71
  pyrogram/methods/advanced/resolve_peer.py,sha256=vXM5M9NiUzbe9nK9LtpIwbHYttyx-89lcZ1CPMbHv0Q,4560
72
- pyrogram/methods/advanced/save_file.py,sha256=WVBc7Py36K1uPqOaFTIdbBGbEs5zJeX4F8-baUdCvFo,8421
72
+ pyrogram/methods/advanced/save_file.py,sha256=_xr48IGiXCF3C2W-6_WNdd5m025i-uGWp7LiFRsg_kA,8433
73
73
  pyrogram/methods/auth/__init__.py,sha256=7oOjTXZkLaq8BlEVxJuM6C5ZhMDe1sA0wMPlsC8UF2Q,1655
74
74
  pyrogram/methods/auth/accept_terms_of_service.py,sha256=qegqafaxszNcOgYCWxTRssXpXJzfKVKexwbqJaEbM1M,1468
75
75
  pyrogram/methods/auth/check_password.py,sha256=5w01ommIRhnbNlQVUeRWJVl3Cp27I4EVI_SvMh2YQIE,1942
@@ -3031,7 +3031,7 @@ pyrogram/types/messages_and_media/message_reactions.py,sha256=ckBrBlFujQdiKCWqV9
3031
3031
  pyrogram/types/messages_and_media/photo.py,sha256=NcQiePNa7fDT4Kvhpxtz9W-lNMfP-d0zpAvXXqWTork,4309
3032
3032
  pyrogram/types/messages_and_media/poll.py,sha256=nLaLRaKpF0nARe4tcSIVWhXIdSG6Q0klT1FAaSowP9g,7037
3033
3033
  pyrogram/types/messages_and_media/poll_option.py,sha256=Cc5q8FMd6sq5u4n2kA5ThWt640qGJGBdoYJtSHlj9lM,1532
3034
- pyrogram/types/messages_and_media/reaction.py,sha256=H9KwyjEYyYCZQV8VyP3M4pW9JiU7an5JkoeaOq7bUfI,2617
3034
+ pyrogram/types/messages_and_media/reaction.py,sha256=LATrkqqDZ7A4aySDkR0qFBX_HNKJ66naRcSKbNI94uA,3098
3035
3035
  pyrogram/types/messages_and_media/sticker.py,sha256=niXemA51ocYI40fZQ6q_GlAyzsZIcuX787JP_F4Gf9I,6909
3036
3036
  pyrogram/types/messages_and_media/story.py,sha256=sNXBTW8aEdff6zT3zxLL3cr0P0rgB0II3o6uUl1uLf4,1627
3037
3037
  pyrogram/types/messages_and_media/stripped_thumbnail.py,sha256=9GpKuySE66njHsJ9YRapMLyKxHKy9_p1lBfEHNDV16c,1431
@@ -3067,10 +3067,10 @@ pyrogram/types/user_and_chats/video_chat_ended.py,sha256=J5xTIAMSGDz8_z-EGrKwkoJ
3067
3067
  pyrogram/types/user_and_chats/video_chat_members_invited.py,sha256=9QhonApJd1XjOeJu9fqx2_u6nIOTZhfXZw_tX9XXxd8,1610
3068
3068
  pyrogram/types/user_and_chats/video_chat_scheduled.py,sha256=rUvDXF8r-2MfsAZKAcaWb_UZt5VoHebPjeJXWRDHGSo,1531
3069
3069
  pyrogram/types/user_and_chats/video_chat_started.py,sha256=WOAuM_CnkRA-W_Iedx0fIHB9RJ-AsvJIiSF05HzLRdA,1043
3070
- pyrogrammod-2.1.2.dist-info/COPYING,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
3071
- pyrogrammod-2.1.2.dist-info/COPYING.lesser,sha256=pWgb-bBdsU2Gd2kwAXxketnm5W_2u8_fIeWEgojfrxs,7651
3072
- pyrogrammod-2.1.2.dist-info/METADATA,sha256=qSZi2WF242juXivr1NwZMpFyDoQtEtvmdOwIGxDpmmI,5633
3073
- pyrogrammod-2.1.2.dist-info/NOTICE,sha256=QL3iJdeVh_ZqRZZchyruQic5bYUWdx3yl0OkSUC2PQc,774
3074
- pyrogrammod-2.1.2.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
3075
- pyrogrammod-2.1.2.dist-info/top_level.txt,sha256=vS2-tKX7dJ1uKjistE5CoOVbv4yqglA95SK0KFEDwl0,9
3076
- pyrogrammod-2.1.2.dist-info/RECORD,,
3070
+ pyrogrammod-2.1.4.dist-info/COPYING,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
3071
+ pyrogrammod-2.1.4.dist-info/COPYING.lesser,sha256=pWgb-bBdsU2Gd2kwAXxketnm5W_2u8_fIeWEgojfrxs,7651
3072
+ pyrogrammod-2.1.4.dist-info/METADATA,sha256=0oYN624qjmXzZIfD_5eKiYY5AvU9m1JK9g85tZ0S0xM,5890
3073
+ pyrogrammod-2.1.4.dist-info/NOTICE,sha256=QL3iJdeVh_ZqRZZchyruQic5bYUWdx3yl0OkSUC2PQc,774
3074
+ pyrogrammod-2.1.4.dist-info/WHEEL,sha256=5Mi1sN9lKoFv_gxcPtisEVrJZihrm_beibeg5R6xb4I,91
3075
+ pyrogrammod-2.1.4.dist-info/top_level.txt,sha256=vS2-tKX7dJ1uKjistE5CoOVbv4yqglA95SK0KFEDwl0,9
3076
+ pyrogrammod-2.1.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5