
    Ii                     (   S r SrSSKJrJrJr  S\S\S\4S jr " S S	\5      r	 " S
 S\	5      r
 " S S\	5      r " S S\	5      r " S S\	5      r " S S\5      r " S S\5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      rg)zThis module contains classes that represent Telegram errors.

.. versionchanged:: 20.0
    Replaced ``Unauthorized`` by :class:`Forbidden`.
)
BadRequestChatMigratedConflictEndPointNotFound	ForbiddenInvalidTokenNetworkErrorPassportDecryptionError
RetryAfterTelegramErrorTimedOut    )OptionalTupleUnionin_slstrreturnc                 N    U R                  U5      (       a  U [        U5      S $ U $ )z
Args:
    in_s (:obj:`str`): in string
    lstr (:obj:`str`): substr to strip from left side

Returns:
    :obj:`str`: The stripped string.

N)
startswithlen)r   r   s     4/venv/lib/python3.13/site-packages/telegram/error.py_lstrip_strr   *   s(     !% 5 54D	?4?    c                   r   ^  \ rS rSrSrSrS\4U 4S jjrS\4S jrS\4S jr	S\
\\
\   4   4S	 jrSrU =r$ )
r   7   a  
Base class for Telegram errors.

Tip:
    Objects of this type can be serialized via Python's :mod:`pickle` module and pickled
    objects from one version of PTB are usually loadable in future versions. However, we can
    not guarantee that this compatibility will always be provided. At least a manual one-time
    conversion of the data may be needed on major updates of the library.

.. seealso:: :wiki:`Exceptions, Warnings and Logging <Exceptions%2C-Warnings-and-Logging>`
messager   c                    > [         TU ]  5         [        US5      n[        US5      n[        US5      nX!:w  a  UR                  5       nX l        g )NzError: z	[Error]: zBad Request: )super__init__r   
capitalizer   )selfr   msg	__class__s      r   r    TelegramError.__init__F   sH    '9-#{+#/>.."Cr   r   c                     U R                   $ )zOGives the string representation of exceptions message.

Returns:
   :obj:`str`
r   r"   s    r   __str__TelegramError.__str__Q   s     ||r   c                 N    U R                   R                   SU R                   S3$ )zUGives an unambiguous string representation of the exception.

Returns:
   :obj:`str`
z('z'))r$   __name__r   r'   s    r   __repr__TelegramError.__repr__Y   s&     ..))*"T\\N"==r   c                 4    U R                   U R                  44$ )zDefines how to serialize the exception for pickle.

.. seealso::
       :py:meth:`object.__reduce__`, :mod:`pickle`.

Returns:
    :obj:`tuple`
r$   r   r'   s    r   
__reduce__TelegramError.__reduce__a   s     ~~..r   )r+   
__module____qualname____firstlineno____doc__	__slots__strr    r(   r,   r   typer0   __static_attributes____classcell__r$   s   @r   r   r   7   sR    
 I	  	  ># >	/E$c
"23 	/ 	/r   r   c                       \ rS rSrSrSrSrg)r   m   zRaised when the bot has not enough rights to perform the requested action.

Examples:
    :any:`Raw API Bot <examples.rawapibot>`

.. versionchanged:: 20.0
    This class was previously named ``Unauthorized``.
 Nr+   r2   r3   r4   r5   r6   r9   r>   r   r   r   r   m   s     Ir   r   c                   F   ^  \ rS rSrSrSrSS\\   SS4U 4S jjjrSr	U =r
$ )	r   z   zRaised when the token is invalid.

Args:
    message (:obj:`str`, optional): Any additional information about the exception.

        .. versionadded:: 20.0
r>   Nr   r   c                 8   > [         TU ]  Uc  S5        g U5        g )NzInvalid tokenr   r    r"   r   r$   s     r   r    InvalidToken.__init__   s    GOIIr   Nr+   r2   r3   r4   r5   r6   r   r7   r    r9   r:   r;   s   @r   r   r   z   s/     IJ J J Jr   r   c                       \ rS rSrSrSrSrg)r      zRaised when the requested endpoint is not found. Only relevant for
:meth:`telegram.Bot.do_api_request`.

.. versionadded:: 20.8
r>   Nr?   r>   r   r   r   r      s     Ir   r   c                       \ rS rSrSrSrSrg)r      a:  Base class for exceptions due to networking errors.

Tip:
    This exception (and its subclasses) usually originates from the networking backend
    used by :class:`~telegram.request.HTTPXRequest`, or a custom implementation of
    :class:`~telegram.request.BaseRequest`. In this case, the original exception can be
    accessed via the ``__cause__``
    `attribute <https://docs.python.org/3/library/exceptions.html#exception-context>`_.

Examples:
    :any:`Raw API Bot <examples.rawapibot>`

.. seealso::
    :wiki:`Handling network errors <Handling-network-errors>`
r>   Nr?   r>   r   r   r   r      s      Ir   r   c                       \ rS rSrSrSrSrg)r      z=Raised when Telegram could not process the request correctly.r>   Nr?   r>   r   r   r   r      s
    GIr   r   c                   F   ^  \ rS rSrSrSrSS\\   SS4U 4S jjjrSr	U =r
$ )	r      zRaised when a request took too long to finish.

.. seealso::
    :wiki:`Handling network errors <Handling-network-errors>`

Args:
    message (:obj:`str`, optional): Any additional information about the exception.

        .. versionadded:: 20.0
r>   Nr   r   c                 6   > [         TU ]  U=(       d    S5        g )Nz	Timed outrC   rD   s     r   r    TimedOut.__init__   s    /K0r   rF   rG   r;   s   @r   r   r      s+    	 I1 1 1 1r   r   c                   V   ^  \ rS rSrSrSrS\4U 4S jjrS\\	\\   4   4S jr
SrU =r$ )r      aO  
Raised when the requested group chat migrated to supergroup and has a new chat id.

.. seealso::
    :wiki:`Storing Bot, User and Chat Related Data <Storing-bot%2C-user-and-chat-related-data>`

Args:
    new_chat_id (:obj:`int`): The new chat id of the group.

Attributes:
    new_chat_id (:obj:`int`): The new chat id of the group.

)new_chat_idrT   c                 6   > [         TU ]  SU 35        Xl        g )Nz+Group migrated to supergroup. New chat id: )r   r    rT   )r"   rT   r$   s     r   r    ChatMigrated.__init__   s    F{mTU +r   r   c                 4    U R                   U R                  44$ rF   )r$   rT   r'   s    r   r0   ChatMigrated.__reduce__       ~~ 0 0222r   )r+   r2   r3   r4   r5   r6   intr    r   r8   r0   r9   r:   r;   s   @r   r   r      s:     !I,C ,3E$c
"23 3 3r   r   c                   V   ^  \ rS rSrSrSrS\4U 4S jjrS\\	\\
   4   4S jrSrU =r$ )r
      aR  
Raised when flood limits where exceeded.

.. versionchanged:: 20.0
   :attr:`retry_after` is now an integer to comply with the Bot API.

Args:
    retry_after (:obj:`int`): Time in seconds, after which the bot can retry the request.

Attributes:
    retry_after (:obj:`int`): Time in seconds, after which the bot can retry the request.

)retry_afterr]   c                 8   > [         TU ]  SU S35        Xl        g )Nz!Flood control exceeded. Retry in z seconds)r   r    r]   )r"   r]   r$   s     r   r    RetryAfter.__init__   s     <[MRS +r   r   c                 4    U R                   U R                  44$ rF   )r$   r]   r'   s    r   r0   RetryAfter.__reduce__   rY   r   )r+   r2   r3   r4   r5   r6   rZ   r    r   r8   floatr0   r9   r:   r;   s   @r   r
   r
      s:     !I,C ,3E$e"45 3 3r   r
   c                   :    \ rS rSrSrSrS\\\\   4   4S jr	Sr
g)r      z>Raised when a long poll or webhook conflicts with another one.r>   r   c                 4    U R                   U R                  44$ rF   r/   r'   s    r   r0   Conflict.__reduce__   s    ~~..r   N)r+   r2   r3   r4   r5   r6   r   r8   r7   r0   r9   r>   r   r   r   r      s$    HI/E$c
"23 /r   r   c                   `   ^  \ rS rSrSrSrS\\\4   4U 4S jjr	S\
\\
\   4   4S jrSrU =r$ )r	      zSomething went wrong with decryption.

.. versionchanged:: 20.0
    This class was previously named ``TelegramDecryptionError`` and was available via
    ``telegram.TelegramDecryptionError``.
)_msgr   c                 J   > [         TU ]  SU 35        [        U5      U l        g )NzPassportDecryptionError: )r   r    r7   ri   rD   s     r   r     PassportDecryptionError.__init__  s#    4WI>?L	r   r   c                 4    U R                   U R                  44$ rF   )r$   ri   r'   s    r   r0   "PassportDecryptionError.__reduce__  s    ~~		|++r   )r+   r2   r3   r4   r5   r6   r   r7   	Exceptionr    r   r8   r0   r9   r:   r;   s   @r   r	   r	      sC     I!c9n 5 !,E$c
"23 , ,r   r	   N)r5   __all__typingr   r   r   r7   r   rn   r   r   r   r   r   r   r   r   r
   r   r	   r>   r   r   <module>rq      s   & * )
@c 
@ 
@ 
@3/I 3/l
 
J= J} = ( 1| 1$3= 323 32/} /,m ,r   