U
    ;g                     @   sJ   d dl mZmZmZmZ d dlZd dlmZ d dlmZ G dd dZdS )    )UnionListAsyncGeneratorOptionalN)raw)typesc                   @   sF   e Zd Zd
deeef eeedeeeef  eed  ddd	Z	dS )GetChatEventLog r   Nzpyrogram.Clientztypes.ChatEventFilter)ztypes.ChatEventN)selfchat_idquery	offset_idlimitfiltersuser_idsreturnc                   s   d}t |pd}td|} tjjj |I dH |d|||rH| nd|dk	rj fdd|D I dH n|dI dH }	|	j	sdS |	j	d }
|
j
}|	j	D ]8}tj ||	j|	jI dH V  |d	7 }||kr dS qqdS )
ak  Get the actions taken by chat members and administrators in the last 48h.

        Only available for supergroups and channels. Requires administrator rights.
        Results are returned in reverse chronological order (i.e., newest first).

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

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.

            query (``str``, *optional*):
                Search query to filter events based on text.
                By default, an empty query is applied and all events will be returned.

            offset_id (``int``, *optional*):
                Offset event identifier from which to start returning results.
                By default, no offset is applied and events will be returned starting from the latest.

            limit (``int``, *optional*):
                Maximum amount of events to be returned.
                By default, all events will be returned.

            filters (:obj:`~pyrogram.types.ChatEventFilter`, *optional*):
                The types of events to return.
                By default, all types will be returned.

            user_ids (List of ``int`` | ``str``, *optional*):
                User identifiers (int) or usernames (str) by which to filter events.
                By default, events relating to all users will be returned.

        Yields:
            :obj:`~pyrogram.types.ChatEvent` objects.

        Example:
            .. code-block:: python

                async for event in app.get_chat_event_log(chat_id):
                    print(event)
        r   l        d   Nc                    s   g | ]}  |I d H qS )N)resolve_peer).0ir
    i/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/pyrogram/methods/chats/get_chat_event_log.py
<listcomp>Z   s     z6GetChatEventLog.get_chat_event_log.<locals>.<listcomp>)ZchannelqZmin_idZmax_idr   Zevents_filterZadmins   )absminZinvoker   Z	functionsZchannelsZGetAdminLogr   writeeventsidr   Z	ChatEvent_parseZusersZchats)r
   r   r   r   r   r   r   currenttotalrlasteventr   r   r   get_chat_event_log   s2    1



z"GetChatEventLog.get_chat_event_log)r	   r   r   NN)
__name__
__module____qualname__r   intstrr   r   r   r(   r   r   r   r   r      s        

r   )	typingr   r   r   r   Zpyrogramr   r   r   r   r   r   r   <module>   s   