
    ;Si                     p    d dl mZmZ ddl mZ ddlmZ 	 ddlZddl	Z	ddl
Z
 G d d      Zy# e$ r Y w xY w)	   )types	functions   )password)BotResponseTimeoutError    Nc                   v    e Zd ZdZd Zed        Zed        Zed        Zed        Z	ed        Z
dddd	d
Zy)MessageButtona+  
    .. note::

        `Message.buttons <telethon.tl.custom.message.Message.buttons>`
        are instances of this type. If you want to **define** a reply
        markup for e.g. sending messages, refer to `Button
        <telethon.tl.custom.button.Button>` instead.

    Custom class that encapsulates a message button providing
    an abstraction to easily access some commonly needed features
    (such as clicking the button itself).

    Attributes:

        button (:tl:`KeyboardButton`):
            The original :tl:`KeyboardButton` object.
    c                 J    || _         || _        || _        || _        || _        y )N)button_bot_chat_msg_id_client)selfclientoriginalchatbotmsg_ids         e/var/www/OnlineNewsSite/project/venv/lib/python3.12/site-packages/telethon/tl/custom/messagebutton.py__init__zMessageButton.__init__   s%    	
    c                     | j                   S )zz
        Returns the `telethon.client.telegramclient.TelegramClient`
        instance that created this instance.
        )r   r   s    r   r   zMessageButton.client%   s     ||r   c                 .    | j                   j                  S )zThe text string of the button.)r   textr   s    r   r   zMessageButton.text-   s     {{r   c                 x    t        | j                  t        j                        r| j                  j                  S y)z:The `bytes` data for :tl:`KeyboardButtonCallback` objects.N)
isinstancer   r   KeyboardButtonCallbackdatar   s    r   r!   zMessageButton.data2   s.     dkk5#?#?@;;### Ar   c                 x    t        | j                  t        j                        r| j                  j                  S y)z=The query `str` for :tl:`KeyboardButtonSwitchInline` objects.N)r   r   r   KeyboardButtonSwitchInlinequeryr   s    r   inline_queryzMessageButton.inline_query8   s.     dkk5#C#CD;;$$$ Er   c                 x    t        | j                  t        j                        r| j                  j                  S y)z2The url `str` for :tl:`KeyboardButtonUrl` objects.N)r   r   r   KeyboardButtonUrlurlr   s    r   r(   zMessageButton.url>   s+     dkk5#:#:;;;??" <r   N)r   open_urlc                  K   t        | j                  t        j                        rD| j                  j                  | j                  | j                  j                  d       d{   S t        | j                  t        j                        r|K| j	                  t        j                  j                                d{   }t        j                  ||      }t        j                  j                  | j                  | j                   | j                  j"                  |      }	 | j	                  |       d{   S t        | j                  t        j&                        ra| j	                  t        j                  j)                  | j*                  | j                  | j                  j,                               d{   S t        | j                  t        j.                        rS|r;dt0        j2                  v r)t5        j6                  | j                  j8                        S | j                  j8                  S t        | j                  t        j:                        rPt        j                  j                  | j                  | j                   d      }	 | j	                  |       d{   S t        | j                  t        j<                        r|st?        d      |dk(  st        |t@              rh| j                  jC                          d{   }t        jD                  |dk(  r|jF                  n||jH                  xs d	|jJ                  xs d	d	
      }| j                  jM                  | j                  |       d{   S t        | j                  t        jN                        r|st?        d      t        |tP        tR        f      r/|\  }}	t        jT                  t        jV                  |	|            }| j                  jM                  | j                  |       d{   S y7 7 t7 # t$        $ r Y yw xY w7 7 # t$        $ r Y yw xY w7 K7 7 7w)a  
        Emulates the behaviour of clicking this button.

        If it's a normal :tl:`KeyboardButton` with text, a message will be
        sent, and the sent `Message <telethon.tl.custom.message.Message>` returned.

        If it's an inline :tl:`KeyboardButtonCallback` with text and data,
        it will be "clicked" and the :tl:`BotCallbackAnswer` returned.

        If it's an inline :tl:`KeyboardButtonSwitchInline` button, the
        :tl:`StartBotRequest` will be invoked and the resulting updates
        returned.

        If it's a :tl:`KeyboardButtonUrl`, the ``URL`` of the button will
        be returned. If you pass ``open_url=True`` the URL of the button will
        be passed to ``webbrowser.open`` and return `True` on success.

        If it's a :tl:`KeyboardButtonRequestPhone`, you must indicate that you
        want to ``share_phone=True`` in order to share it. Sharing it is not a
        default because it is a privacy concern and could happen accidentally.

        You may also use ``share_phone=phone`` to share a specific number, in
        which case either `str` or :tl:`InputMediaContact` should be used.

        If it's a :tl:`KeyboardButtonRequestGeoLocation`, you must pass a
        tuple in ``share_geo=(longitude, latitude)``. Note that Telegram seems
        to have some heuristics to determine impossible locations, so changing
        this value a lot quickly may not work as expected. You may also pass a
        :tl:`InputGeoPoint` if you find the order confusing.
        N)
parse_mode)peerr   r!   r   )r   r,   start_param
webbrowserT)r,   r   gamez5cannot click on phone buttons unless share_phone=True )phone_number
first_name	last_namevcardzBcannot click on geo buttons unless share_geo=(longitude, latitude))latlong),r   r   r   KeyboardButtonr   send_messager   r   r    r   accountGetPasswordRequestpwd_modcompute_checkmessagesGetBotCallbackAnswerRequestr   r!   r   r#   StartBotRequestr   r$   r'   sysmodulesr.   openr(   KeyboardButtonGameKeyboardButtonRequestPhone
ValueErrorstrget_meInputMediaContactphoner2   r3   	send_file KeyboardButtonRequestGeoLocationtuplelistInputMediaGeoPointInputGeoPoint)
r   share_phone	share_geor   r)   pwdreqmer6   r5   s
             r   clickzMessageButton.clickD   sb    > dkk5#7#7822

DKK,, 3 ? ? ?U%A%AB# LL):):)M)M)OPP"00h?$$@@ZZ4;;;K;K! A C!\\#... U%E%EFi&8&8&H&HIIDJJDKK<M<M 'I '    U%<%<=3;;.%??4;;??;;;;??"U%=%=>$$@@ZZ4 A C!\\#... U%E%EF !XYYd"jc&B<<..00#55-8D-@k!}}2 ll0b	 //

KHHHU%K%KL !eff)eT]3%	c!44U5H5HSW[5\]	//

IFFF M]? Q /*  /*  1 I Gs   A$Q&&P2'AQ&P5A%Q&(P; <P8=P;  BQ&Q
CQ&Q ,Q-Q 0A$Q&QA3Q&Q"	B#Q&,Q$-Q&5Q&8P; ;	QQ&QQ&Q 	QQ&QQ&"Q&$Q&)NN)__name__
__module____qualname____doc__r   propertyr   r   r!   r%   r(   rU    r   r   r
   r
      s    "       $ $
 % %
 # #
VGW[ VGr   r
   )r0   r   r   r   r;   errorsr   r.   ModuleNotFoundErrorr@   osr
   r[   r   r   <module>r_      s@     # -	  	NG NG  		s   - 55