o
    Xzj  ã                   @   s:   d dl Z ddlmZmZ ddlmZmZ G dd„ dƒZdS )é    Né   )ÚutilsÚhints)ÚtypesÚcustomc                   @   s"   e Zd Ze				ddd„ƒZdS )	ÚButtonMethodsÚbuttonsú!typing.Optional[hints.MarkupLike]Úreturnú&typing.Optional[types.TypeReplyMarkup]c                 C   sˆ  | du rdS z
| j dkr| W S W n	 ty   Y nw t | ¡s$| gg} n| r-t | d ¡s0| g} d}d}d}d}d}d}d}g }| D ]g}	g }
|	D ]V}t|tjƒr||jdurX|j}|jdur`|j}|j	durh|j	}|j
durp|j
}|jdurx|j}|j}n	t|tjƒr…|j}tj |¡}||O }|| O }|j dkrž|
 |¡ qH|
r©| t |
¡¡ qB|r²|r²tdƒ‚|r¹t |¡S tj||||||d�S )aq  
        Builds a :tl:`ReplyInlineMarkup` or :tl:`ReplyKeyboardMarkup` for
        the given buttons.

        Does nothing if either no buttons are provided or the provided
        argument is already a reply markup.

        You should consider using this method if you are going to reuse
        the markup very often. Otherwise, it is not necessary.

        This method is **not** asynchronous (don't use ``await`` on it).

        Arguments
            buttons (`hints.MarkupLike`):
                The button, list of buttons, array of buttons or markup
                to convert into a markup.

        Example
            .. code-block:: python

                from telethon import Button

                markup = client.build_reply_markup(Button.inline('hi'))
                # later
                await client.send_message(chat, 'click me', buttons=markup)
        Nl   òÂE r   Fi£t­z)You cannot mix inline with normal buttons)ÚrowsÚresizeÚ
single_useÚ	selectiveÚ
persistentÚplaceholder)ÚSUBCLASS_OF_IDÚAttributeErrorr   Úis_list_likeÚ
isinstancer   ÚButtonr   r   r   r   r   ÚbuttonÚMessageButtonÚ
_is_inlineÚappendr   ÚKeyboardButtonRowÚ
ValueErrorÚReplyInlineMarkupÚReplyKeyboardMarkup)r   Ú	is_inlineÚ	is_normalr   r   r   r   r   r   ÚrowÚcurrentr   Úinline© r$   úR/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telethon/client/buttons.pyÚbuild_reply_markup   sv   
ÿÿ









€€
úz ButtonMethods.build_reply_markupN)r   r	   r
   r   )Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr&   r$   r$   r$   r%   r      s    ÿþr   )ÚtypingÚ r   r   Útlr   r   r   r$   r$   r$   r%   Ú<module>   s    