Document pin_chat_message

This commit is contained in:
Dan 2018-07-14 00:44:50 +02:00
parent 84e7bb5c50
commit f8d44b8e77

View File

@ -22,7 +22,29 @@ from ...ext import BaseClient
class PinChatMessage(BaseClient):
def pin_chat_message(self, chat_id: int or str, message_id: int, disable_notification: bool = None):
# TODO: Docstrings
"""Use this method to pin a message in a supergroup or a channel.
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.
Args:
chat_id (``int`` | ``str``):
Unique identifier (int) or username (str) of the target chat.
For a private channel/supergroup you can use its *t.me/joinchat/* link.
message_id (``int``):
Identifier of a message to pin.
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.
Returns:
True on success.
Raises:
:class:`Error <pyrogram.Error>`
``ValueError``: If a chat_id doesn't belong to a supergroup or a channel.
"""
peer = self.resolve_peer(chat_id)
if isinstance(peer, types.InputPeerChannel):