
    ;Si                     4    d dl mZmZ ddl mZ  G d d      Zy)   )types	functions   )utilsc                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZddddZed        Zed        Zed        Zed        Zed        Zed        Zed        Z	 	 	 ddZd Zy)InlineResulta'  
    Custom class that encapsulates a bot inline result providing
    an abstraction to easily access some commonly needed features
    (such as clicking a result to select it).

    Attributes:

        result (:tl:`BotInlineResult`):
            The original :tl:`BotInlineResult` object.
    articlephotogifvideo	mpeg4_gifaudiodocumentlocationvenuecontactgameN)entityc                <    || _         || _        || _        || _        y N)_clientresult	_query_id_entity)selfclientoriginalquery_idr   s        d/var/www/OnlineNewsSite/project/venv/lib/python3.12/site-packages/telethon/tl/custom/inlineresult.py__init__zInlineResult.__init__    s    !    c                 .    | j                   j                  S )a  
        The always-present type of this result. It will be one of:
        ``'article'``, ``'photo'``, ``'gif'``, ``'mpeg4_gif'``, ``'video'``,
        ``'audio'``, ``'voice'``, ``'document'``, ``'location'``, ``'venue'``,
        ``'contact'``, ``'game'``.

        You can access all of these constants through `InlineResult`,
        such as `InlineResult.ARTICLE`, `InlineResult.VIDEO_GIF`, etc.
        )r   typer   s    r   r#   zInlineResult.type&   s     {{r!   c                 .    | j                   j                  S )zz
        The always-present :tl:`BotInlineMessage` that
        will be sent if `click` is called on this result.
        )r   send_messager$   s    r   messagezInlineResult.message3   s     {{'''r!   c                 .    | j                   j                  S )zE
        The title for this inline result. It may be `None`.
        )r   titler$   s    r   r)   zInlineResult.title;   s    
 {{   r!   c                 .    | j                   j                  S )zK
        The description for this inline result. It may be `None`.
        )r   descriptionr$   s    r   r+   zInlineResult.descriptionB   s    
 {{&&&r!   c                 x    t        | j                  t        j                        r| j                  j                  S y)z
        The URL present in this inline results. If you want to "click"
        this URL to open it in your browser, you should use Python's
        `webbrowser.open(url)` for such task.
        N)
isinstancer   r   BotInlineResulturlr$   s    r   r/   zInlineResult.urlI   s+     dkk5#8#89;;??" :r!   c                     t        | j                  t        j                        r| j                  j                  S t        | j                  t        j
                        r| j                  j                  S y)z
        Returns either the :tl:`WebDocument` thumbnail for
        normal results or the :tl:`Photo` for media results.
        N)r-   r   r   r.   thumbBotInlineMediaResultr
   r$   s    r   r
   zInlineResult.photoS   sR     dkk5#8#89;;$$$U%?%?@;;$$$ Ar!   c                     t        | j                  t        j                        r| j                  j                  S t        | j                  t        j
                        r| j                  j                  S y)z
        Returns either the :tl:`WebDocument` content for
        normal results or the :tl:`Document` for media results.
        N)r-   r   r   r.   contentr2   r   r$   s    r   r   zInlineResult.document^   sR     dkk5#8#89;;&&&U%?%?@;;''' Ar!   c                 P  K   |r$| j                   j                  |       d{   }n$| j                  r| j                  }nt        d      |r(| j                   j	                  ||       d{   \  }}n|dnt        j                  |      }t        j                  j                  || j                  | j                  j                  |||||dnt        j                  |            }	| j                   j                  |	| j                  |	       d{   |      S 7 7 7 w)a  
        Clicks this result and sends the associated `message`.

        Args:
            entity (`entity`):
                The entity to which the message of this result should be sent.

            reply_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
                If present, the sent message will reply to this ID or message.

            comment_to (`int` | `Message <telethon.tl.custom.message.Message>`, optional):
                Similar to ``reply_to``, but replies in the linked group of a
                broadcast channel instead (effectively leaving a "comment to"
                the specified message).

            silent (`bool`, optional):
                Whether the message should notify people with sound or not.
                Defaults to `False` (send with a notification sound unless
                the person has the chat muted). Set it to `True` to alter
                this behaviour.

            clear_draft (`bool`, optional):
                Whether the draft should be removed after sending the
                message from this result or not. Defaults to `False`.

            hide_via (`bool`, optional):
                Whether the "via @bot" should be hidden or not.
                Only works with certain bots (like @bing or @gif).

            background (`bool`, optional):
                Whether the message should be send in background.

        Nz>You must provide the entity where the result should be sent to)peerr   idsilent
backgroundclear_drafthide_viareply_to)r   get_input_entityr   
ValueError_get_comment_datar   get_message_idr   messagesSendInlineBotResultRequestr   r   r7   r   InputReplyToMessage_get_response_message)
r   r   r<   
comment_tor8   r:   r;   r9   reply_idreqs
             r   clickzInlineResult.clicki   s    H <<88@@F\\\\F]^^%)\\%C%CFJ%WWFH'/tU5I5I(5SH  ;;^^{{~~!#%-T53L3LX3V < 	
 ||11t||C((&2 	2+ A  X )s5   !D&D A
D&.D"/B'D&D$

D&"D&$D&c                    K   | j                   s| j                  r@ | j                  j                  | j                   xs | j                  g|i | d{   S y7 w)a  
        Downloads the media in this result (if there is a document, the
        document will be downloaded; otherwise, the photo will if present).

        This is a wrapper around `client.download_media
        <telethon.client.downloads.DownloadMethods.download_media>`.
        N)r   r
   r   download_media)r   argskwargss      r   rJ   zInlineResult.download_media   s]      ==DJJ444+>.2>6<> > > '>s   AAAAr   )NNNFFFN)__name__
__module____qualname____doc__ARTICLEPHOTOGIFVIDEO	VIDEO_GIFAUDIODOCUMENTLOCATIONVENUECONTACTGAMEr    propertyr#   r'   r)   r+   r/   r
   r   rH   rJ    r!   r   r   r      s    	 GE
CEIEHHEGD$  
  
  ( ( ! ! ' ' # # % % ( ( BF>C#;2z
>r!   r   N) r   r   r   r   r]   r!   r   <module>r_      s     k> k>r!   