o
    -˜Žj  ã                   @   s6   d dl mZ d dlZd dlmZmZ G dd„ dƒZdS )é    )ÚUnionN)ÚrawÚenumsc                   @   sP   e Zd Zdejjddfdddeeef deddd	eeef d
edefdd„Z	dS )ÚSearchMessagesCountÚ NÚselfzpyrogram.ClientÚchat_idÚqueryÚfilterzenums.MessagesFilterÚ	from_userÚ	thread_idÚreturnc                 Ã   st   �|   tjjj|  |¡I dH || ¡ ddddddd|r#|  |¡I dH ndd|d�¡I dH }t|dƒr5|jS t	|jƒS )a  Get the count of messages resulting from a search inside a chat.

        If you want to get the actual messages, see :meth:`~pyrogram.Client.search_messages`.

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

        Parameters:
            chat_id (``int`` | ``str``):
                Unique identifier (int) or username (str) of the target chat.
                For your personal cloud (Saved Messages) you can simply use "me" or "self".
                For a contact that exists in your Telegram address book you can use his phone number (str).
                You can also use chat public link in form of *t.me/<username>* (str).

            query (``str``, *optional*):
                Text query string.
                Required for text-only messages, optional for media messages (see the ``filter`` argument).
                When passed while searching for media messages, the query will be applied to captions.
                Defaults to "" (empty string).

            filter (:obj:`~pyrogram.enums.MessagesFilter`, *optional*):
                Pass a filter in order to search for specific kind of messages only:

            from_user (``int`` | ``str``, *optional*):
                Unique identifier (int) or username (str) of the target user you want to search for messages from.

            thread_id (``int``, *optional*):
                Unique identifier of the thread (Message.message_thread_id or Message.reply_top_message_id) to search in.

        Returns:
            ``int``: On success, the messages count is returned.
        Nr   é   )ÚpeerÚqr
   Úmin_dateÚmax_dateÚ	offset_idÚ
add_offsetÚlimitÚmin_idÚmax_idÚfrom_idÚhashÚ
top_msg_idÚcount)
Úinvoker   Ú	functionsÚmessagesÚSearchÚresolve_peerÚvalueÚhasattrr   Úlen)r   r   r	   r
   r   r   Úr© r%   úl/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/pyrogram/methods/messages/search_messages_count.pyÚsearch_messages_count   s.   €'ÿï
ÿ

z)SearchMessagesCount.search_messages_count)
Ú__name__Ú
__module__Ú__qualname__r   ÚMessagesFilterÚEMPTYr   ÚintÚstrr'   r%   r%   r%   r&   r      s(    úÿ
þýü
ûúùr   )Útypingr   Úpyrogramr   r   r   r%   r%   r%   r&   Ú<module>   s   