WPyrogram 2.0.121__py3-none-any.whl → 2.0.123__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.1
2
2
  Name: WPyrogram
3
- Version: 2.0.121
3
+ Version: 2.0.123
4
4
  Summary: Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots - Amano's experimental fork
5
5
  Home-page: https://github.com/ALiwoto/WPyrogram
6
6
  Download-URL: https://github.com/AmanoTeam/pyrogram
@@ -1,4 +1,4 @@
1
- pyrogram/__init__.py,sha256=CwuNw7RLg3bQpctaa58V67-YPjqFmDC5dpuquDBabw8,1400
1
+ pyrogram/__init__.py,sha256=85K8_B0_t4AjRskRb1qoVfupIB1Z3MEfDP7eg6iq6XM,1400
2
2
  pyrogram/client.py,sha256=ZGIswWl-_EacPx8pB3BexUgaHhEJ85qAYlM1GqBaops,46518
3
3
  pyrogram/dispatcher.py,sha256=vOYzolziyRNu8Tc1ja5pFotBtp_EPmAYAMZb24HV0ls,10191
4
4
  pyrogram/emoji.py,sha256=ixb3OXR1XpLf3BQpw8kWIpmbQRowRIaFedjdnuzljac,208021
@@ -68,7 +68,7 @@ pyrogram/handlers/raw_update_handler.py,sha256=9Uh0oVyDm4AgQ39Y87JaebeL5V6HM1eE6
68
68
  pyrogram/handlers/user_status_handler.py,sha256=NcrvIuvaE8cwccG0cgSjGtN12IVLbDi1OZqDmiuht8k,1989
69
69
  pyrogram/helpers/__init__.py,sha256=m_M6ou18C90xwO3l1gstKqLHVIQCZYGCdikR4uAFOfQ,818
70
70
  pyrogram/helpers/helpers.py,sha256=ZWe6V_SOMmZZBeq_r7hBmweGcKCUwPg4W6aUthquAcY,2042
71
- pyrogram/methods/__init__.py,sha256=6PpIkjIGLQ_e50nySmI2yjLPym5TGz1YIkHFRUQg_qg,1320
71
+ pyrogram/methods/__init__.py,sha256=o2Z2H8MOw4e5_Qq3rnmkEabe7mgrUAbQ_apL3E3ugF8,1362
72
72
  pyrogram/methods/advanced/__init__.py,sha256=nRNLZaThEQylTXtzEbPoQz0s4A5GcJrH7C_dwKKJ530,988
73
73
  pyrogram/methods/advanced/invoke.py,sha256=cduAX4lBhqJ6GF6psrwEw3uRFnnEggk_fuyeD3Nmbo4,3133
74
74
  pyrogram/methods/advanced/resolve_peer.py,sha256=vXM5M9NiUzbe9nK9LtpIwbHYttyx-89lcZ1CPMbHv0Q,4560
@@ -183,7 +183,7 @@ pyrogram/methods/invite_links/get_chat_invite_link_joiners.py,sha256=DO5I-4MyFmp
183
183
  pyrogram/methods/invite_links/get_chat_invite_link_joiners_count.py,sha256=H-uRoL2JRlrZbXxwbVdb0VqxQsijDX6DTfEaDXljk1g,1929
184
184
  pyrogram/methods/invite_links/get_chat_join_requests.py,sha256=8vvbKTl0stM5RQi77wSC5xqO_0MJdcFtPoIcULHIQJQ,2947
185
185
  pyrogram/methods/invite_links/revoke_chat_invite_link.py,sha256=zY_-XAQYXb6B0C1-7Zl6AoYpkMPKjrVhC6MTfaVZMLQ,2329
186
- pyrogram/methods/messages/__init__.py,sha256=fsevXxUQQaeVVRPcvTboMszxpQ9sK_zh0jabfLUYj8I,4119
186
+ pyrogram/methods/messages/__init__.py,sha256=zFTiBc2xN-NpHXkhBgZLsv5E_oZ4XGZvbHD0PpINUXQ,4070
187
187
  pyrogram/methods/messages/copy_media_group.py,sha256=Mg8senFAZQYKvVimcWGI7bKQb6O245PVZAgG6if0q9A,6197
188
188
  pyrogram/methods/messages/copy_message.py,sha256=vH9qP6VRqwzmXARJ8391hbUaZPlrQ0nCLmx8P0ZpayE,5179
189
189
  pyrogram/methods/messages/delete_messages.py,sha256=PgsVHswsRQ_f9ympNS7DM8-gHHBnnBRw4Du4evqYnJA,3148
@@ -226,7 +226,6 @@ pyrogram/methods/messages/send_photo.py,sha256=D6iTfi0RK7NRWZs0YmLnCZ4fEubgzNFGW
226
226
  pyrogram/methods/messages/send_poll.py,sha256=y_wMJDiZ4CKIVVjz5xVA9da2lFPe8xvdH1Lpc1pwj8Y,8305
227
227
  pyrogram/methods/messages/send_reaction.py,sha256=zm0iKvaU2XEcagld6kEvrpuX7XoumFIiVSij1W-pLUo,2361
228
228
  pyrogram/methods/messages/send_sticker.py,sha256=J88lnK5v9R7dIfGAmalfqS-OmRSAVsaUEzC9ZZ9DrVU,8576
229
- pyrogram/methods/messages/send_story.py,sha256=26rNoLweBk9JfYFIOojEnzaroOJWuEegL8aEf9XSuZ4,11656
230
229
  pyrogram/methods/messages/send_venue.py,sha256=SmeJdUelb56bKQAqxFCEGJG91tcbp9PcmNC-1UxcUTE,5633
231
230
  pyrogram/methods/messages/send_video.py,sha256=O0gaUSVdkC3ZZR2Y-a75wfF8HLvLYN0M_WaW6xbEdAY,12192
232
231
  pyrogram/methods/messages/send_video_note.py,sha256=22T-pmQOQxShch8KW0VdCvyjB7G1WnTnHIgjzuzVNVg,9551
@@ -240,6 +239,8 @@ pyrogram/methods/password/__init__.py,sha256=Ok9BhMf3Z96wqF3US1qqjGT67z5mylwQdDC
240
239
  pyrogram/methods/password/change_cloud_password.py,sha256=UYwjT1MsALY49cixsm-XY-Kw9IuoeDESecAyVVoBnec,2797
241
240
  pyrogram/methods/password/enable_cloud_password.py,sha256=W5tVXfwoGCgfvBM7EDlx976Hazl21lVKjbpK8Rc-iFQ,3006
242
241
  pyrogram/methods/password/remove_cloud_password.py,sha256=JidQpLomzEs6teTcF3zNcthYrapIvCfhBfgaBptcyyM,2143
242
+ pyrogram/methods/stories/__init__.py,sha256=d79VjlM9pYnbwQHrNcnEC7I0yEMLHReuz65a0tF4D8Y,76
243
+ pyrogram/methods/stories/send_story.py,sha256=dH2DZ-4j1YZMx86GAOUA8FSq1Vt12-iRsqg8WjV421E,13955
243
244
  pyrogram/methods/users/__init__.py,sha256=vQ6XbYSvPnfYMWAT5YH6bZNOXBxiyp-NW9sTeI16Lpo,1659
244
245
  pyrogram/methods/users/block_user.py,sha256=aT-FyS-FaUrzQjeG6QHNhrMiJoSloCVPHyBgrwoA-LI,1875
245
246
  pyrogram/methods/users/delete_profile_photos.py,sha256=0-YdzEv3DTWZcmb9NWQ4hCTFowoczZK2p8EQJTYzk_8,2237
@@ -2661,10 +2662,10 @@ pyrogram/types/user_and_chats/video_chat_ended.py,sha256=J5xTIAMSGDz8_z-EGrKwkoJ
2661
2662
  pyrogram/types/user_and_chats/video_chat_members_invited.py,sha256=9QhonApJd1XjOeJu9fqx2_u6nIOTZhfXZw_tX9XXxd8,1610
2662
2663
  pyrogram/types/user_and_chats/video_chat_scheduled.py,sha256=rUvDXF8r-2MfsAZKAcaWb_UZt5VoHebPjeJXWRDHGSo,1531
2663
2664
  pyrogram/types/user_and_chats/video_chat_started.py,sha256=WOAuM_CnkRA-W_Iedx0fIHB9RJ-AsvJIiSF05HzLRdA,1043
2664
- WPyrogram-2.0.121.dist-info/COPYING,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
2665
- WPyrogram-2.0.121.dist-info/COPYING.lesser,sha256=pWgb-bBdsU2Gd2kwAXxketnm5W_2u8_fIeWEgojfrxs,7651
2666
- WPyrogram-2.0.121.dist-info/METADATA,sha256=IRqiEDpz1-ZgyEAutJt8LqsLWX5nPxZLPHxiK4_nupM,5029
2667
- WPyrogram-2.0.121.dist-info/NOTICE,sha256=QL3iJdeVh_ZqRZZchyruQic5bYUWdx3yl0OkSUC2PQc,774
2668
- WPyrogram-2.0.121.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
2669
- WPyrogram-2.0.121.dist-info/top_level.txt,sha256=vS2-tKX7dJ1uKjistE5CoOVbv4yqglA95SK0KFEDwl0,9
2670
- WPyrogram-2.0.121.dist-info/RECORD,,
2665
+ WPyrogram-2.0.123.dist-info/COPYING,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
2666
+ WPyrogram-2.0.123.dist-info/COPYING.lesser,sha256=pWgb-bBdsU2Gd2kwAXxketnm5W_2u8_fIeWEgojfrxs,7651
2667
+ WPyrogram-2.0.123.dist-info/METADATA,sha256=fbqqbLd1tTQGtOFY3WpnB7WGBRgnsZHsRz0zDoTzwNc,5029
2668
+ WPyrogram-2.0.123.dist-info/NOTICE,sha256=QL3iJdeVh_ZqRZZchyruQic5bYUWdx3yl0OkSUC2PQc,774
2669
+ WPyrogram-2.0.123.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
2670
+ WPyrogram-2.0.123.dist-info/top_level.txt,sha256=vS2-tKX7dJ1uKjistE5CoOVbv4yqglA95SK0KFEDwl0,9
2671
+ WPyrogram-2.0.123.dist-info/RECORD,,
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.0.121"
19
+ __version__ = "2.0.123"
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
 
@@ -25,6 +25,7 @@ from .decorators import Decorators
25
25
  from .invite_links import InviteLinks
26
26
  from .messages import Messages
27
27
  from .password import Password
28
+ from .stories import Stories
28
29
  from .users import Users
29
30
  from .utilities import Utilities
30
31
 
@@ -35,6 +36,7 @@ class Methods(
35
36
  Bots,
36
37
  Contacts,
37
38
  Password,
39
+ Stories,
38
40
  Chats,
39
41
  Users,
40
42
  Messages,
@@ -57,7 +57,6 @@ from .send_photo import SendPhoto
57
57
  from .send_poll import SendPoll
58
58
  from .send_reaction import SendReaction
59
59
  from .send_sticker import SendSticker
60
- from .send_story import SendStory
61
60
  from .send_venue import SendVenue
62
61
  from .send_video import SendVideo
63
62
  from .send_video_note import SendVideoNote
@@ -88,7 +87,6 @@ class Messages(
88
87
  SendMessage,
89
88
  SendPhoto,
90
89
  SendSticker,
91
- SendStory,
92
90
  SendVenue,
93
91
  SendVideo,
94
92
  SendVideoNote,
@@ -0,0 +1,6 @@
1
+ from .send_story import SendStory
2
+
3
+ class Stories(
4
+ SendStory
5
+ ):
6
+ pass
@@ -34,11 +34,13 @@ class SendStory:
34
34
  async def send_story(
35
35
  self: "pyrogram.Client",
36
36
  story: Union[str, BinaryIO],
37
+ chat_id: Union[int, str] = "me",
37
38
  caption: str = "",
38
39
  parse_mode: Optional["enums.ParseMode"] = None,
39
40
  caption_entities: List["types.MessageEntity"] = None,
41
+ media_area: List["raw.base.MediaArea"] = None,
40
42
  has_spoiler: bool = None,
41
- pinned: bool = False,
43
+ pinned: bool = True,
42
44
  ttl_seconds: int = None,
43
45
  period: int = None,
44
46
  duration: int = 0,
@@ -48,12 +50,13 @@ class SendStory:
48
50
  file_name: str = None,
49
51
  supports_streaming: bool = True,
50
52
  protect_content: bool = None,
53
+ privacy_rules: Optional[List["raw.base.InputPrivacyRule"]] = None,
51
54
  progress: Callable = None,
52
55
  progress_args: tuple = ()
53
56
  ) -> Optional["types.Message"]:
54
- """Send video files.
57
+ """Upload a story on a user profile or channel.
55
58
 
56
- .. include:: /_includes/usable-by/users-bots.rst
59
+ .. include:: /_includes/usable-by/users.rst
57
60
 
58
61
  Parameters:
59
62
  chat_id (``int`` | ``str``):
@@ -61,8 +64,8 @@ class SendStory:
61
64
  For your personal cloud (Saved Messages) you can simply use "me" or "self".
62
65
  For a contact that exists in your Telegram address book you can use his phone number (str).
63
66
 
64
- video (``str`` | ``BinaryIO``):
65
- Video to send.
67
+ story (``str`` | ``BinaryIO``):
68
+ story to send.
66
69
  Pass a file_id as string to send a video that exists on the Telegram servers,
67
70
  pass an HTTP URL as a string for Telegram to get a video from the Internet,
68
71
  pass a file path as string to upload a new video that exists on your local machine, or
@@ -224,17 +227,55 @@ class SendStory:
224
227
  ]
225
228
  )
226
229
 
230
+ if not privacy_rules:
231
+ privacy_rules = [raw.types.InputPrivacyValueAllowCloseFriends()]
232
+ elif isinstance(privacy_rules, str):
233
+ # try to parse it from str
234
+ privacy_rules = privacy_rules.lower().replace("-", "")
235
+ if privacy_rules == "closefriends" or privacy_rules == "friends":
236
+ privacy_rules = [raw.types.InputPrivacyValueAllowCloseFriends()]
237
+ elif privacy_rules == "contacts":
238
+ privacy_rules = [raw.types.InputPrivacyValueAllowContacts()]
239
+ elif privacy_rules == "all":
240
+ privacy_rules = [raw.types.InputPrivacyValueAllowAll()]
241
+ else:
242
+ raise Exception(f"Invalid str value specified for privacy_rules: {privacy_rules}")
243
+ elif isinstance(privacy_rules, list):
244
+ # a list of input users
245
+ all_allowed_users = []
246
+ all_disallowed_users = []
247
+ correct_privacy_rules = []
248
+ for current_privacy_rule in privacy_rules:
249
+ is_disallowed = isinstance(current_privacy_rule, str) and current_privacy_rule.startswith('!')
250
+ if is_disallowed:
251
+ current_privacy_rule = current_privacy_rule[1:]
252
+
253
+ current_peer = await self.resolve_peer(current_privacy_rule)
254
+ if not isinstance(current_peer, pyrogram.raw.base.InputUser):
255
+ # yeah well... telegram is gonna return us error anyway...
256
+ continue
257
+
258
+ if is_disallowed: all_disallowed_users.append(current_peer)
259
+ else: all_allowed_users.append(current_peer)
260
+
261
+ if all_allowed_users:
262
+ correct_privacy_rules.append(all_allowed_users)
263
+ if all_disallowed_users:
264
+ correct_privacy_rules.append(all_disallowed_users)
265
+
266
+ privacy_rules = correct_privacy_rules
267
+
227
268
  while True:
228
269
  try:
229
270
  r = await self.invoke(
230
271
  raw.functions.stories.send_story.SendStory(
231
- peer=await self.resolve_peer("me"),
272
+ peer=await self.resolve_peer(chat_id),
232
273
  media=media,
233
- privacy_rules=None,
274
+ privacy_rules=privacy_rules,
234
275
  random_id=self.rnd_id(),
235
276
  pinned=pinned,
236
277
  noforwards=protect_content,
237
- media_areas=None,
278
+ media_areas=media_area,
238
279
  period=period,
239
280
  **await utils.parse_caption_entities(self, caption, parse_mode, caption_entities)
240
281
  )