Message.pin()

Message.pin()

Bound method pin of Message.

Use as a shortcut for:

await client.pin_chat_message(
    chat_id=message.chat.id,
    message_id=message_id
)

Example

await message.pin()
Parameters:
  • disable_notification (``bool``) – Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels.

  • both_sides (``bool``, *optional*) – Pass True to pin the message for both sides (you and recipient). Applicable to private chats only. Defaults to False.

Returns:

  • :obj:`~pyrogram.types.Message` | ``bool`` (On success, the service message is returned (when applicable),)

  • otherwise, in case a message object couldn’t be returned, True is returned.

Raises:

RPCError –