Skip to content

Commit 2fef4d3

Browse files
committed
Update
1 parent 1914983 commit 2fef4d3

9 files changed

Lines changed: 54 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://github.com/pyrogram/pyrogram">
3-
<img src="https://i.imgur.com/BOgY9ai.png" alt="Pyrogram">
3+
<img src="https://docs.pyrogram.org/_static/pyrogram.png" alt="Pyrogram" width="128">
44
</a>
55
<br>
66
<b>Telegram MTProto API Framework for Python</b>
@@ -9,7 +9,7 @@
99
Documentation
1010
</a>
1111
12-
<a href="https://github.com/pyrogram/pyrogram/releases">
12+
<a href="https://docs.pyrogram.org/releases">
1313
Releases
1414
</a>
1515

compiler/api/source/main_api.tl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1734,4 +1734,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
17341734
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
17351735
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
17361736

1737-
// LAYER 138
1737+
// LAYER 138

compiler/docs/compiler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ def get_title_list(s: str) -> list:
544544
inline_query="""
545545
InlineQuery
546546
InlineQuery.answer
547+
""",
548+
chat_join_request="""
549+
ChatJoinRequest
550+
ChatJoinRequest.approve
551+
ChatJoinRequest.decline
547552
"""
548553
)
549554

compiler/docs/template/bound-methods.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,17 @@ InlineQuery
9191
:hidden:
9292

9393
{inline_query_toctree}
94+
95+
ChatJoinRequest
96+
---------------
97+
98+
.. hlist::
99+
:columns: 2
100+
101+
{chat_join_request_hlist}
102+
103+
.. toctree::
104+
:hidden:
105+
106+
{chat_join_request_toctree}
107+

pyrogram/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
__version__ = "1.3.7"
19+
__version__ = "1.4.1"
2020
__license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)"
2121
__copyright__ = "Copyright (C) 2017-present Dan <https://github.com/delivrance>"
2222

pyrogram/parser/html.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,17 @@ def unparse(text: str, entities: list):
174174

175175
entities_offsets.append((start_tag, start,))
176176
entities_offsets.append((end_tag, end,))
177-
178-
for entity, offset in reversed(entities_offsets):
177+
178+
entities_offsets = map(
179+
lambda x: x[1],
180+
sorted(
181+
enumerate(entities_offsets),
182+
key = lambda x: (x[1][1], x[0]),
183+
reverse = True
184+
)
185+
)
186+
187+
for entity, offset in entities_offsets:
179188
text = text[:offset] + entity + text[offset:]
180189

181190
return utils.remove_surrogates(text)

pyrogram/types/messages_and_media/message.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ def __init__(
316316
from_scheduled: bool = None,
317317
media: str = None,
318318
edit_date: int = None,
319+
edit_hide: bool = False,
319320
media_group_id: str = None,
320321
author_signature: str = None,
321322
has_protected_content: bool = None,
@@ -388,6 +389,7 @@ def __init__(
388389
self.from_scheduled = from_scheduled
389390
self.media = media
390391
self.edit_date = edit_date
392+
self.edit_hide = edit_hide
391393
self.media_group_id = media_group_id
392394
self.author_signature = author_signature
393395
self.has_protected_content = has_protected_content
@@ -674,6 +676,14 @@ async def _parse(
674676
video_attributes = attributes.get(raw.types.DocumentAttributeVideo, None)
675677
animation = types.Animation._parse(client, doc, video_attributes, file_name)
676678
media_type = "animation"
679+
elif raw.types.DocumentAttributeSticker in attributes:
680+
sticker = await types.Sticker._parse(
681+
client, doc,
682+
attributes.get(raw.types.DocumentAttributeImageSize, None),
683+
attributes[raw.types.DocumentAttributeSticker],
684+
file_name
685+
)
686+
media_type = "sticker"
677687
elif raw.types.DocumentAttributeVideo in attributes:
678688
video_attributes = attributes[raw.types.DocumentAttributeVideo]
679689

@@ -683,14 +693,6 @@ async def _parse(
683693
else:
684694
video = types.Video._parse(client, doc, video_attributes, file_name, media.ttl_seconds)
685695
media_type = "video"
686-
elif raw.types.DocumentAttributeSticker in attributes:
687-
sticker = await types.Sticker._parse(
688-
client, doc,
689-
attributes.get(raw.types.DocumentAttributeImageSize, None),
690-
attributes[raw.types.DocumentAttributeSticker],
691-
file_name
692-
)
693-
media_type = "sticker"
694696
else:
695697
document = types.Document._parse(client, doc, file_name)
696698
media_type = "document"
@@ -768,6 +770,7 @@ async def _parse(
768770
from_scheduled=message.from_scheduled,
769771
media=media_type,
770772
edit_date=message.edit_date,
773+
edit_hide=message.edit_hide,
771774
media_group_id=message.grouped_id,
772775
photo=photo,
773776
location=location,

pyrogram/types/messages_and_media/sticker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class Sticker(Object):
4646
is_animated (``bool``):
4747
True, if the sticker is animated
4848
49+
is_video (``bool``):
50+
True, if the sticker is a video sticker
51+
4952
file_name (``str``, *optional*):
5053
Sticker file name.
5154
@@ -79,6 +82,7 @@ def __init__(
7982
width: int,
8083
height: int,
8184
is_animated: bool,
85+
is_video: bool,
8286
file_name: str = None,
8387
mime_type: str = None,
8488
file_size: int = None,
@@ -98,6 +102,7 @@ def __init__(
98102
self.width = width
99103
self.height = height
100104
self.is_animated = is_animated
105+
self.is_video = is_video
101106
self.emoji = emoji
102107
self.set_name = set_name
103108
self.thumbs = thumbs
@@ -167,6 +172,7 @@ async def _parse(
167172
width=image_size_attributes.w if image_size_attributes else 512,
168173
height=image_size_attributes.h if image_size_attributes else 512,
169174
is_animated=sticker.mime_type == "application/x-tgsticker",
175+
is_video=sticker.mime_type == "video/webm",
170176
# TODO: mask_position
171177
set_name=set_name,
172178
emoji=sticker_attributes.alt or None,

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def run(self):
172172
"Documentation": "https://docs.pyrogram.org",
173173
},
174174
python_requires="~=3.6",
175+
package_data = {
176+
"pyrogram": ["py.typed"],
177+
},
175178
packages=find_packages(exclude=["compiler*", "tests*"]),
176179
zip_safe=False,
177180
install_requires=requires,

0 commit comments

Comments
 (0)