Skip to content

Commit 2a99702

Browse files
committed
(fix): Type Hinting of pin_chat_message
1 parent aa9b848 commit 2a99702

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pyrogram/methods/chats/pin_chat_message.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def pin_chat_message(
3232
disable_notification: bool = False,
3333
both_sides: bool = False,
3434
business_connection_id: str = None,
35-
) -> "types.Message":
35+
) -> Union["types.Message", bool]:
3636
"""Pin a message in a group, channel or your own chat.
3737
You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in
3838
the supergroup or "can_edit_messages" admin right in the channel.
@@ -58,7 +58,8 @@ async def pin_chat_message(
5858
Unique identifier of the business connection on behalf of which the message will be pinned.
5959
6060
Returns:
61-
:obj:`~pyrogram.types.Message`: On success, the service message is returned.
61+
:obj:`~pyrogram.types.Message` | ``bool``: On success, the service message is returned (when applicable),
62+
otherwise, in case a message object couldn't be returned, True is returned.
6263
6364
Example:
6465
.. code-block:: python
@@ -131,3 +132,4 @@ async def pin_chat_message(
131132
raw_reply_to_message=i.reply_to_message,
132133
replies=0
133134
)
135+
return True

pyrogram/types/messages_and_media/message.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5613,7 +5613,7 @@ async def vote(
56135613
options=option
56145614
)
56155615

5616-
async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> "types.Message":
5616+
async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> Union["Message", bool]:
56175617
"""Bound method *pin* of :obj:`~pyrogram.types.Message`.
56185618
56195619
Use as a shortcut for:
@@ -5640,7 +5640,8 @@ async def pin(self, disable_notification: bool = False, both_sides: bool = False
56405640
Applicable to private chats only. Defaults to False.
56415641
56425642
Returns:
5643-
:obj:`~pyrogram.types.Message`: On success, the service message is returned.
5643+
:obj:`~pyrogram.types.Message` | ``bool``: On success, the service message is returned (when applicable),
5644+
otherwise, in case a message object couldn't be returned, True is returned.
56445645
56455646
Raises:
56465647
RPCError: In case of a Telegram RPC error.

0 commit comments

Comments
 (0)