Skip to content

Commit e89f8ee

Browse files
committed
Updated to 1.4.9
Update to 1.4.9 from the latest commit on the official repo https://github.com/pyrogram/pyrogram/
1 parent 8ad2b0d commit e89f8ee

4 files changed

Lines changed: 26 additions & 13 deletions

File tree

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

pyrogram/client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,7 @@ def __enter__(self):
251251
return self.start()
252252

253253
def __exit__(self, *args):
254-
try:
255-
self.stop()
256-
except ConnectionError:
257-
pass
254+
self.stop()
258255

259256
async def __aenter__(self):
260257
return await self.start()

pyrogram/methods/chats/pin_chat_message.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from typing import Union
2020

21-
from pyrogram import raw
21+
from pyrogram import raw, types
2222
from pyrogram.scaffold import Scaffold
2323

2424

@@ -29,7 +29,7 @@ async def pin_chat_message(
2929
message_id: int,
3030
disable_notification: bool = False,
3131
both_sides: bool = False,
32-
) -> bool:
32+
) -> "types.Message":
3333
"""Pin a message in a group, channel or your own chat.
3434
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
3535
the supergroup or "can_edit_messages" admin right in the channel.
@@ -50,7 +50,7 @@ async def pin_chat_message(
5050
Applicable to private chats only. Defaults to False.
5151
5252
Returns:
53-
``bool``: True on success.
53+
:obj:`~pyrogram.types.Message`: On success, the service message is returned.
5454
5555
Example:
5656
.. code-block:: python
@@ -61,7 +61,7 @@ async def pin_chat_message(
6161
# Pin without notification
6262
app.pin_chat_message(chat_id, message_id, disable_notification=True)
6363
"""
64-
await self.send(
64+
r = await self.send(
6565
raw.functions.messages.UpdatePinnedMessage(
6666
peer=await self.resolve_peer(chat_id),
6767
id=message_id,
@@ -70,4 +70,10 @@ async def pin_chat_message(
7070
)
7171
)
7272

73-
return True
73+
users = {u.id: u for u in r.users}
74+
chats = {c.id: c for c in r.chats}
75+
76+
for i in r.updates:
77+
if isinstance(i, (raw.types.UpdateNewMessage,
78+
raw.types.UpdateNewChannelMessage)):
79+
return await types.Message._parse(self, i.message, users, chats)

pyrogram/types/messages_and_media/message.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,9 @@ async def reply_text(
866866
disable_web_page_preview: bool = None,
867867
disable_notification: bool = None,
868868
reply_to_message_id: int = None,
869-
reply_markup=None
869+
schedule_date: int = None,
870+
protect_content: bool = None,
871+
reply_markup = None
870872
) -> "Message":
871873
"""Bound method *reply_text* of :obj:`~pyrogram.types.Message`.
872874
@@ -916,6 +918,12 @@ async def reply_text(
916918
reply_to_message_id (``int``, *optional*):
917919
If the message is a reply, ID of the original message.
918920
921+
schedule_date (``int``, *optional*):
922+
Date when the message will be automatically sent. Unix time.
923+
924+
protect_content (``bool``, *optional*):
925+
Protects the contents of the sent message from forwarding and saving.
926+
919927
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
920928
Additional interface options. An object for an inline keyboard, custom reply keyboard,
921929
instructions to remove reply keyboard or to force a reply from the user.
@@ -940,6 +948,8 @@ async def reply_text(
940948
disable_web_page_preview=disable_web_page_preview,
941949
disable_notification=disable_notification,
942950
reply_to_message_id=reply_to_message_id,
951+
schedule_date=schedule_date,
952+
protect_content=protect_content,
943953
reply_markup=reply_markup
944954
)
945955

@@ -3416,7 +3426,7 @@ async def vote(
34163426
options=option
34173427
)
34183428

3419-
async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> bool:
3429+
async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> "types.Message":
34203430
"""Bound method *pin* of :obj:`~pyrogram.types.Message`.
34213431
34223432
Use as a shortcut for:
@@ -3443,7 +3453,7 @@ async def pin(self, disable_notification: bool = False, both_sides: bool = False
34433453
Applicable to private chats only. Defaults to False.
34443454
34453455
Returns:
3446-
True on success.
3456+
:obj:`~pyrogram.types.Message`: On success, the service message is returned.
34473457
34483458
Raises:
34493459
RPCError: In case of a Telegram RPC error.

0 commit comments

Comments
 (0)