
    YiO                         S r SSKrSSKJrJr  SSKJrJrJrJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJrJr  \" S
5      r\(       a  SSKJr   " S S\\\\4   5      rg)z9This module contains the ChosenInlineResultHandler class.    N)MatchPattern)TYPE_CHECKINGAnyOptionalTypeVarUnioncast)Update)DEFAULT_TRUE)DVType)BaseHandler)CCTHandlerCallbackRT)Applicationc                      ^  \ rS rSrSrSr\S4SSS\\\	\
4   S\\   S	\\\\\   4      4U 4S
 jjjrS\S\\\\4      4S jrS\	S\SSS\\\\   4   SS4
S jrSrU =r$ )ChosenInlineResultHandler$   a1  Handler class to handle Telegram updates that contain
:attr:`telegram.Update.chosen_inline_result`.

Warning:
    When setting :paramref:`block` to :obj:`False`, you cannot rely on adding custom
    attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info.

Args:
    callback (:term:`coroutine function`): The callback function for this handler. Will be
        called when :meth:`check_update` has determined that an update should be processed by
        this handler. Callback signature::

            async def callback(update: Update, context: CallbackContext)

        The return value of the callback is usually ignored except for the special case of
        :class:`telegram.ext.ConversationHandler`.
    block (:obj:`bool`, optional): Determines whether the return value of the callback should
        be awaited before processing the next handler in
        :meth:`telegram.ext.Application.process_update`. Defaults to :obj:`True`.

        .. seealso:: :wiki:`Concurrency`
    pattern (:obj:`str` | :func:`re.Pattern <re.compile>`, optional): Regex pattern. If not
        :obj:`None`, :func:`re.match`
        is used on :attr:`telegram.ChosenInlineResult.result_id` to determine if an update
        should be handled by this handler. This is accessible in the callback as
        :attr:`telegram.ext.CallbackContext.matches`.

        .. versionadded:: 13.6
Attributes:
    callback (:term:`coroutine function`): The callback function for this handler.
    block (:obj:`bool`): Determines whether the return value of the callback should be
        awaited before processing the next handler in
        :meth:`telegram.ext.Application.process_update`.
    pattern (`Pattern`): Optional. Regex pattern to test
        :attr:`telegram.ChosenInlineResult.result_id` against.

        .. versionadded:: 13.6

)patternNselfz"ChosenInlineResultHandler[CCT, RT]callbackblockr   c                    > [         TU ]  XS9  [        U[        5      (       a  [        R
                  " U5      nX0l        g )N)r   )super__init__
isinstancestrrecompiler   )r   r   r   r   	__class__s       [/app/.venv/lib/python3.13/site-packages/telegram/ext/_handlers/choseninlineresulthandler.pyr   "ChosenInlineResultHandler.__init__O   s5     	/gs##jj)G;B    updatereturnc                     [        U[        5      (       ac  UR                  (       aR  U R                  (       a@  [        R
                  " U R                  UR                  R                  5      =n(       a  U$  ggg)zDetermines whether an update should be passed to this handler's :attr:`callback`.

Args:
    update (:class:`telegram.Update` | :obj:`object`): Incoming update.

Returns:
    :obj:`bool` | :obj:`re.match`

TN)r   r   chosen_inline_resultr   r   match	result_id)r   r%   r)   s      r"   check_update&ChosenInlineResultHandler.check_update\   s^     ff%%&*E*E||HHT\\63N3N3X3XYY5Y L Z  r$   contextapplicationz)Application[Any, CCT, Any, Any, Any, Any]check_resultc                 X    U R                   (       a  [        [        U5      nU/Ul        gg)zeThis function adds the matched regex pattern result to
:attr:`telegram.ext.CallbackContext.matches`.
N)r   r
   r   matches)r   r-   r%   r.   r/   s        r"   collect_additional_context4ChosenInlineResultHandler.collect_additional_contextn   s%     <<|4L+nGO r$   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r   r   r   r   boolr   r	   r   r   r   objectr+   r   r2   __static_attributes____classcell__)r!   s   @r"   r   r   $   s    &P I
 +6:	C2C!&#r/2C d|C %WS\ 123	C C6 huT6\7J.K $-- - A	-
 D%*,-- 
- -r$   r   )r8   r   r   r   typingr   r   r   r   r	   r
   telegramr   telegram._utils.defaultvaluer   telegram._utils.typesr   "telegram.ext._handlers.basehandlerr   telegram.ext._utils.typesr   r   r   telegram.extr   r    r$   r"   <module>rF      sN   & @ 	  E E  5 ( : :T](V-FCO < V-r$   