
    j                     D    d dl mZ ddl mZmZmZ ddl mZ  G d d      Zy)	   )Draft   )TLObjecttypes	functions   )utilsc                   >    e Zd ZdZd Zd Zd
dZddZd Zd Z	d Z
y	)Dialoga|
  
    Custom class that encapsulates a dialog (an open "conversation" with
    someone, a group or a channel) providing an abstraction to easily
    access the input version/normal entity/message etc. The library will
    return instances of this class when calling :meth:`.get_dialogs()`.

    Args:
        dialog (:tl:`Dialog`):
            The original ``Dialog`` instance.

        pinned (`bool`):
            Whether this dialog is pinned to the top or not.

        folder_id (`folder_id`):
            The folder ID that this dialog belongs to.

        archived (`bool`):
            Whether this dialog is archived or not (``folder_id is None``).

        message (`Message <telethon.tl.custom.message.Message>`):
            The last message sent on this dialog. Note that this member
            will not be updated when new messages arrive, it's only set
            on creation of the instance.

        date (`datetime`):
            The date of the last message sent on this dialog.

        entity (`entity`):
            The entity that belongs to this dialog (user, chat or channel).

        input_entity (:tl:`InputPeer`):
            Input version of the entity.

        id (`int`):
            The marked ID of the entity, which is guaranteed to be unique.

        name (`str`):
            Display name for this dialog. For chats and channels this is
            their title, and for users it's "First-Name Last-Name".

        title (`str`):
            Alias for `name`.

        unread_count (`int`):
            How many messages are currently unread in this dialog. Note that
            this value won't update when new messages arrive.

        unread_mentions_count (`int`):
            How many mentions are currently unread in this dialog. Note that
            this value won't update when new messages arrive.

        unread_reactions_count (`int`):
            How many reactions are currently unread in this dialog. Note that
            this value won't update when new messages arrive.

        unread_poll_votes_count (`int`):
            How many poll votes are currently unread in this dialog. Note that
            this value won't update when new messages arrive.

        draft (`Draft <telethon.tl.custom.draft.Draft>`):
            The draft object in this dialog. It will not be `None`,
            so you can call ``draft.set_message(...)``.

        is_user (`bool`):
            `True` if the `entity` is a :tl:`User`.

        is_group (`bool`):
            `True` if the `entity` is a :tl:`Chat`
            or a :tl:`Channel` megagroup.

        is_channel (`bool`):
            `True` if the `entity` is a :tl:`Channel`.
    c                    || _         || _        t        |j                        | _        |j                  | _        |j                  d u| _        || _        t        | j                  dd       | _        |t        j                  |j                           | _        t        j                  | j                        | _        t        j                  | j                        | _        t        j                   | j                        x| _        | _        |j&                  | _        |j(                  | _        |j*                  | _        |j,                  | _        t/        || j                  | j                  j0                        | _        t3        | j                  t4        j6                        | _        t3        | j                  t4        j:                  t4        j<                  f      xs< t3        | j                  t4        j>                        xr | j                  j@                  | _!        t3        | j                  t4        j>                        | _"        y )Ndate)#_clientdialogboolpinned	folder_idarchivedmessagegetattrr   r	   get_peer_idpeerentityget_input_peerinput_entityidget_display_namenametitleunread_countunread_mentions_countunread_reactions_countunread_poll_votes_countr   draft
isinstancer   Useris_userChatChatForbiddenChannel	megagroupis_group
is_channel)selfclientr   entitiesr   s        ]/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/telethon/tl/custom/dialog.py__init__zDialog.__init__P   s   6==)))((4DLL&$7	u00=>!00=##DKK0!&!7!7!DD	DJ"//%+%A%A"&,&C&C#'-'E'E$64;;0A0AB
!$++uzz:t{{UZZ1D1D$EF OU]]3M8M8M 	 %T[[%--@    c                 r   K    | j                   j                  | j                  g|i | d{   S 7 w)z
        Sends a message to this dialog. This is just a wrapper around
        ``client.send_message(dialog.input_entity, *args, **kwargs)``.
        N)r   send_messager   )r-   argskwargss      r0   r4   zDialog.send_messagem   sD     
 /T\\..0 $0(.0 0 	0 0s   .757c                 n   K   | j                   j                  | j                  |       d{    y7 w)a  
        Deletes the dialog from your dialog list. If you own the
        channel this won't destroy it, only delete it from the list.

        Shorthand for `telethon.client.dialogs.DialogMethods.delete_dialog`
        with ``entity`` already set.
        )revokeN)r   delete_dialogr   )r-   r8   s     r0   deletezDialog.deleteu   s)      ll((V(DDDs   +535c                    K   | j                  t        j                  j                  t	        j
                  | j                  |      g             d{   S 7 w)a  
        Archives (or un-archives) this dialog.

        Args:
            folder (`int`, optional):
                The folder to which the dialog should be archived to.

                If you want to "un-archive" it, use ``folder=0``.

        Returns:
            The :tl:`Updates` object that the request produces.

        Example:

            .. code-block:: python

                # Archiving
                dialog.archive()

                # Un-archiving
                dialog.archive(0)
        )r   N)r   r   foldersEditPeerFoldersRequestr   InputFolderPeerr   )r-   folders     r0   archivezDialog.archive   sR     . \\)"3"3"J"J!!$"3"3vFL
 #   	 s   AAAAc                 x    d| j                   | j                  | j                  | j                  | j                  dS )Nr   )_r   r   r#   r   r   )r   r   r#   r   r   r-   s    r0   to_dictzDialog.to_dict   s2    IIIIZZ||kk
 	
r2   c                 H    t        j                  | j                               S )Nr   pretty_formatrD   rC   s    r0   __str__zDialog.__str__   s    %%dlln55r2   c                 L    t        j                  | j                         d      S )N    )indentrF   rC   s    r0   	stringifyzDialog.stringify   s    %%dllnQ??r2   N)F)r   )__name__
__module____qualname____doc__r1   r4   r:   r@   rD   rH   rL    r2   r0   r   r      s/    HRA:0E6
6@r2   r   N) r   r   r   r   r	   r   rQ   r2   r0   <module>rS      s     ) ) e@ e@r2   