o
    XzjÂ
  ã                   @   s(   d dl Z ddlmZ G dd„ deƒZdS )é    Né   )ÚInlineResultc                       sF   e Zd ZdZddœ‡ fdd„
Zdd„ Zdd	„ Zd
d„ Zdd„ Z‡  Z	S )ÚInlineResultsaj  
    Custom class that encapsulates :tl:`BotResults` providing
    an abstraction to easily access some commonly needed features
    (such as clicking one of the results to select it)

    Note that this is a list of `InlineResult
    <telethon.tl.custom.inlineresult.InlineResult>`
    so you can iterate over it or use indices to
    access its elements. In addition, it has some
    attributes.

    Attributes:
        result (:tl:`BotResults`):
            The original :tl:`BotResults` object.

        query_id (`int`):
            The random ID that identifies this query.

        cache_time (`int`):
            For how long the results should be considered
            valid. You can call `results_valid` at any
            moment to determine if the results are still
            valid or not.

        users (:tl:`User`):
            The users present in this inline query.

        gallery (`bool`):
            Whether these results should be presented
            in a grid (as a gallery of images) or not.

        next_offset (`str`, optional):
            The string to be used as an offset to get
            the next chunk of results, if any.

        switch_pm (:tl:`InlineBotSwitchPM`, optional):
            If presents, the results should show a button to
            switch to a private conversation with the bot using
            the text in this object.
    N©Úentityc                   sn   t ƒ  ‡ ‡‡fdd„ˆjD ƒ¡ ˆ| _ˆj| _ˆj| _t ¡ | j | _ˆj| _t	ˆj
ƒ| _
ˆj| _ˆj| _d S )Nc                 3   s"   � | ]}t ˆ |ˆjˆd �V  qdS )r   N)r   Úquery_id©Ú.0Úx©Úclientr   Úoriginal© ú[/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telethon/tl/custom/inlineresults.pyÚ	<genexpr>0   s   € ÿz)InlineResults.__init__.<locals>.<genexpr>)ÚsuperÚ__init__ÚresultsÚresultr   Ú
cache_timeÚtimeÚ_valid_untilÚusersÚboolÚgalleryÚnext_offsetÚ	switch_pm)Úselfr   r   r   ©Ú	__class__r   r   r   /   s   ÿzInlineResults.__init__c                 C   s   t   ¡ | jk S )z}
        Returns `True` if the cache time has not expired
        yet and the results can still be considered valid.
        )r   r   ©r   r   r   r   Úresults_valid<   s   zInlineResults.results_validc              	      s6   d  d ‡ fdd„| D ƒ¡| j| j| j| j| j| j¡S )NzT[{}, query_id={}, cache_time={}, users={}, gallery={}, next_offset={}, switch_pm={}]z, c                 3   s   � | ]}ˆ |ƒV  qd S ©Nr   r   ©Úitem_functionr   r   r   F   s   € z(InlineResults._to_str.<locals>.<genexpr>)ÚformatÚjoinr   r   r   r   r   r   )r   r$   r   r#   r   Ú_to_strC   s   ùÿzInlineResults._to_strc                 C   ó
   |   t¡S r"   )r'   Ústrr    r   r   r   Ú__str__O   ó   
zInlineResults.__str__c                 C   r(   r"   )r'   Úreprr    r   r   r   Ú__repr__R   r+   zInlineResults.__repr__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r!   r'   r*   r-   Ú__classcell__r   r   r   r   r      s    (r   )r   Úinlineresultr   Úlistr   r   r   r   r   Ú<module>   s    