diff --git a/pyrogram/methods/chats/pin_chat_message.py b/pyrogram/methods/chats/pin_chat_message.py index c36281ebe..d7a368cac 100644 --- a/pyrogram/methods/chats/pin_chat_message.py +++ b/pyrogram/methods/chats/pin_chat_message.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from typing import Union +from typing import Union, Optional import pyrogram from pyrogram import raw, types, utils @@ -29,7 +29,7 @@ async def pin_chat_message( message_id: int, disable_notification: bool = False, both_sides: bool = False, - ) -> "types.Message": + ) -> Optional["types.Message"]: """Pin a message in a group, channel or your own chat. You must be an administrator in the chat for this to work and must have the "can_pin_messages" admin right in the supergroup or "can_edit_messages" admin right in the channel. diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 03cd91ed8..57c99ad40 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -6030,7 +6030,7 @@ async def vote( options=option ) - async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> "types.Message": + async def pin(self, disable_notification: bool = False, both_sides: bool = False) -> Optional["types.Message"]: """Bound method *pin* of :obj:`~pyrogram.types.Message`. Use as a shortcut for: