o
    -˜ŽjE  ã                   @   sB   d dl mZ d dlZd dlmZmZ ddlmZ G dd„ dƒZdS )é    )ÚUnionN)ÚrawÚtypesé   )Úget_sessionc                   @   sB   e Zd Z			ddddeeef dededed	ed
dfdd„ZdS )ÚPinChatMessageFNÚselfzpyrogram.ClientÚchat_idÚ
message_idÚdisable_notificationÚ
both_sidesÚbusiness_connection_idÚreturnztypes.Messagec                 Ã   s  �t jjj|  |¡I dH ||pd| pdd�}d}d}|r7| j| }|s,|  |¡I dH }t| |jj	j
ƒI dH }|rH| t jj||d�¡I dH }	n|  |¡I dH }	dd„ |	jD ƒ}
dd„ |	jD ƒ}|	jD ]!}t|t jjt jjt jjfƒr„tjj| |j|
||d�I dH   S qcdS )al  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.

        .. include:: /_includes/usable-by/users-bots.rst

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                You can also use chat public link in form of *t.me/<username>* (str).

            message_id (``int``):
                Identifier of a message to pin.

            disable_notification (``bool``, *optional*):
                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.
                
            business_connection_id (``str``, *optional*):
                Unique identifier of the business connection on behalf of which the message will be pinned.

        Returns:
            :obj:`~pyrogram.types.Message`: On success, the service message is returned.

        Example:
            .. code-block:: python

                # Pin with notification
                await app.pin_chat_message(chat_id, message_id)

                # Pin without notification
                await app.pin_chat_message(chat_id, message_id, disable_notification=True)
        N)ÚpeerÚidÚsilentÚ
pm_oneside)ÚqueryÚconnection_idc                 S   ó   i | ]}|j |“qS © ©r   )Ú.0Úur   r   úd/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/chats/pin_chat_message.pyÚ
<dictcomp>g   ó    z3PinChatMessage.pin_chat_message.<locals>.<dictcomp>c                 S   r   r   r   )r   Úcr   r   r   r   h   r   )r   )r   Ú	functionsÚmessagesÚUpdatePinnedMessageÚresolve_peerÚbusiness_user_connection_cacheÚget_business_connectionr   Ú_rawÚ
connectionÚdc_idÚinvokeÚInvokeWithBusinessConnectionÚusersÚchatsÚupdatesÚ
isinstancer   ÚUpdateNewMessageÚUpdateNewChannelMessageÚUpdateBotNewBusinessMessageÚMessageÚ_parseÚmessage)r   r	   r
   r   r   r   ÚrpcÚsessionÚbusiness_connectionÚrr)   r*   Úir   r   r   Úpin_chat_message   sF   €-ü

þþÿ

þ"ýÿzPinChatMessage.pin_chat_message)FFN)Ú__name__Ú
__module__Ú__qualname__r   ÚintÚstrÚboolr8   r   r   r   r   r      s&    úÿ
þýüûúùr   )Útypingr   Úpyrogramr   r   Úmessages.inline_sessionr   r   r   r   r   r   Ú<module>   s
   