1818
1919from typing import Union
2020
21- from pyrogram import raw
21+ from pyrogram import raw , types
2222from 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 )
0 commit comments