o
    XzjP  ã                   @   s8   d dl mZmZmZ ddlmZ eG dd„ deƒƒZdS )é   )ÚEventBuilderÚEventCommonÚname_inner_eventé   )Útypesc                   @   s.   e Zd ZdZeddd„ƒZG dd„ deƒZdS )ÚMessageDeleteda»  
    Occurs whenever a message is deleted. Note that this event isn't 100%
    reliable, since Telegram doesn't always notify the clients that a message
    was deleted.

    .. important::

        Telegram **does not** send information about *where* a message
        was deleted if it occurs in private conversations with other users
        or in small group chats, because message IDs are *unique* and you
        can identify the chat with the message ID alone if you saved it
        previously.

        Telethon **does not** save information of where messages occur,
        so it cannot know in which chat a message was deleted (this will
        only work in channels, where the channel ID *is* present).

        This means that the ``chats=`` parameter will not work reliably,
        unless you intend on working with channels and super-groups only.

    Example
        .. code-block:: python

            from telethon import events

            @client.on(events.MessageDeleted)
            async def handler(event):
                # Log all deleted message IDs
                for msg_id in event.deleted_ids:
                    print('Message', msg_id, 'was deleted in', event.chat_id)
    Nc                 C   sD   t |tjƒr| j|jd d�S t |tjƒr | j|jt |j¡d�S d S )N)Údeleted_idsÚpeer)Ú
isinstancer   ÚUpdateDeleteMessagesÚEventÚmessagesÚUpdateDeleteChannelMessagesÚPeerChannelÚ
channel_id)ÚclsÚupdateÚothersÚself_id© r   úY/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telethon/events/messagedeleted.pyÚbuild&   s   þ
þÿzMessageDeleted.buildc                       s   e Zd Z‡ fdd„Z‡  ZS )zMessageDeleted.Eventc                    s6   t ƒ j||pdgd d� |sd n|d | _|| _d S )Né    )Ú	chat_peerÚmsg_id)ÚsuperÚ__init__Ú
deleted_idr   )Úselfr   r	   ©Ú	__class__r   r   r   4   s
   ÿ
zMessageDeleted.Event.__init__)Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__r   r   r   r   r   3   s    r   )NN)r!   r"   r#   Ú__doc__Úclassmethodr   r   r   r   r   r   r   r      s
    r   N)Úcommonr   r   r   Útlr   r   r   r   r   r   Ú<module>   s    