
    Yi/                         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  \(       a  SS
KJr  \" S5      r " S S\\\\4   5      rg)z2This module contains the InlineQueryHandler class.    N)MatchPattern)TYPE_CHECKINGAnyOptionalTypeVarUnioncast)Update)DEFAULT_TRUE)DVType)BaseHandler)CCTHandlerCallback)ApplicationRTc                      ^  \ rS rSrSrSrS\S4SSS\\\	\
4   S\\\\\   4      S	\\   S
\\\      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$ )InlineQueryHandler$   an	  
BaseHandler class to handle Telegram updates that contain a
:attr:`telegram.Update.inline_query`.
Optionally based on a regex. Read the documentation of the :mod:`re` module for more
information.

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.
    * :attr:`telegram.InlineQuery.chat_type` will not be set for inline queries from secret
      chats and may not be set for inline queries coming from third-party clients. These
      updates won't be handled, if :attr:`chat_types` is passed.

Examples:
    :any:`Inline Bot <examples.inlinebot>`


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`.
    pattern (:obj:`str` | :func:`re.Pattern <re.compile>`, optional): Regex pattern.
        If not :obj:`None`, :func:`re.match` is used on :attr:`telegram.InlineQuery.query`
        to determine if an update should be handled by this handler.
    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`
    chat_types (list[:obj:`str`], optional): List of allowed chat types. If passed, will only
        handle inline queries with the appropriate :attr:`telegram.InlineQuery.chat_type`.

        .. versionadded:: 13.5
Attributes:
    callback (:term:`coroutine function`): The callback function for this handler.
    pattern (:obj:`str` | :func:`re.Pattern <re.compile>`): Optional. Regex pattern to test
        :attr:`telegram.InlineQuery.query` against.
    chat_types (list[:obj:`str`]): Optional. List of allowed chat types.

        .. versionadded:: 13.5
    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`.

)
chat_typespatternNselfzInlineQueryHandler[CCT, RT]callbackr   blockr   c                    > [         TU ]  XS9  [        U[        5      (       a  [        R
                  " U5      nX l        X@l        g )N)r   )super__init__
isinstancestrrecompiler   r   )r   r   r   r   r   	__class__s        T/app/.venv/lib/python3.13/site-packages/telegram/ext/_handlers/inlinequeryhandler.pyr   InlineQueryHandler.__init__Z   s:     	/gs##jj)G;B/9    updatereturnc                    [        U[        5      (       a  UR                  (       a  U R                  b%  UR                  R                  U R                  ;  a  gU R
                  (       aY  UR                  R                  (       a>  [        R                  " U R
                  UR                  R                  5      =n(       a  U$ U R
                  (       d  gg)z
Determines 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`

NFT)	r   r   inline_queryr   	chat_typer   queryr    match)r   r&   r,   s      r#   check_updateInlineQueryHandler.check_updatei   s     ff%%&*=*=+##--T__D''-- hht||V5H5H5N5NOOUO<<r%   contextapplicationz)Application[Any, CCT, Any, Any, Any, Any]check_resultc                 X    U R                   (       a  [        [        U5      nU/Ul        gg)zAdd the result of ``re.match(pattern, update.inline_query.query)`` to
:attr:`CallbackContext.matches` as list with one element.
N)r   r
   r   matches)r   r/   r&   r0   r1   s        r#   collect_additional_context-InlineQueryHandler.collect_additional_context   s%     <<|4L+nGO r%   )__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r   r   r   r   r	   r   r   r   boollistr   objectr   r-   r4   __static_attributes____classcell__)r"   s   @r#   r   r   $   s    1f *I
 7;**.:+:!&#r/2: %WS\ 123: d|	:
 T#Y': :6 huT5:=M7N.O 4-- - A	-
 uT5:%567- 
- -r%   r   )r:   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   telegram.extr   r   r    r%   r#   <module>rI      sM   & 9 	  E E  5 ( : :(T]k-VS"_5 k-r%   