
    ;Si                     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.

        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                 L   || _         || _        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(                  | _        t+        || j                  | j                  j,                        | _        t/        | j                  t0        j2                        | _        t/        | j                  t0        j6                  t0        j8                  f      xs< t/        | j                  t0        j:                        xr | j                  j<                  | _        t/        | j                  t0        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_countr   draft
isinstancer   Useris_userChatChatForbiddenChannel	megagroupis_group
is_channel)selfclientr   entitiesr   s        ^/var/www/OnlineNewsSite/project/venv/lib/python3.12/site-packages/telethon/tl/custom/dialog.py__init__zDialog.__init__H   sr   6==)))((4DLL&$7	u00=>!00=##DKK0!&!7!7!DD	DJ"//%+%A%A"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      r.   r2   zDialog.send_messagec   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+   r6   s     r.   deletezDialog.deletek   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     r.   archivezDialog.archivex   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    r.   to_dictzDialog.to_dict   s2    IIIIZZ||kk
 	
r0   c                 H    t        j                  | j                               S )Nr   pretty_formatrB   rA   s    r.   __str__zDialog.__str__   s    %%dlln55r0   c                 L    t        j                  | j                         d      S )N    )indentrD   rA   s    r.   	stringifyzDialog.stringify   s    %%dllnQ??r0   N)F)r   )__name__
__module____qualname____doc__r/   r2   r8   r>   rB   rF   rJ    r0   r.   r   r      s/    @BA60E6
6@r0   r   N) r   r   r   r   r	   r   rO   r0   r.   <module>rQ      s     ) ) [@ [@r0   