U
    hP                     @   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   ZUpdateDeleteMessagesEventmessagesZUpdateDeleteChannelMessagesZPeerChannelZ
channel_id)clsupdateZothersself_id r   B/tmp/pip-unpacked-wheel-c81u5j2r/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    )Z	chat_peerZmsg_id)super__init__Z
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   