
    > /i                        d Z dZddlmZmZmZ dededefdZ G d d	e      Z	 G d
 de	      Z
 G d de	      Z G d de	      Z G d de      Z G d de      Z G d de	      Z G d de	      Z G d de	      Z G d de	      Zy)zThis module contains classes that represent Telegram errors.

.. versionchanged:: 20.0
    Replaced ``Unauthorized`` by :class:`Forbidden`.
)

BadRequestChatMigratedConflict	ForbiddenInvalidTokenNetworkErrorPassportDecryptionError
RetryAfterTelegramErrorTimedOut    )OptionalTupleUnionin_slstrreturnc                 D    | j                  |      r| t        |      d S | S )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     D/srv/sistema/bot/venv/lib/python3.12/site-packages/telegram/error.py_lstrip_strr   )   s%     !% 54D	?4?    c                   `     e Zd ZdZdZdef fdZdefdZdefdZde	e
e	e   f   fdZ xZS )	r
   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         |           t        |d      }t        |d      }t        |d      }||k7  r|j                         }|| _        y )NzError: z	[Error]: zBad Request: )super__init__r   
capitalizer   )selfr   msg	__class__s      r   r   zTelegramError.__init__E   sL    '9-#{+#/'>.."Cr   r   c                     | j                   S Nr   r    s    r   __str__zTelegramError.__str__P   s    ||r   c                 N    | j                   j                   d| j                   dS )Nz('z'))r"   __name__r   r%   s    r   __repr__zTelegramError.__repr__S   s$    ..))*"T\\N"==r   c                 4    | j                   | j                  ffS r$   r"   r   r%   s    r   
__reduce__zTelegramError.__reduce__V       ~~..r   )r(   
__module____qualname____doc__	__slots__strr   r&   r)   r   typer,   __classcell__r"   s   @r   r
   r
   6   sM    
 I	  	  ># >/E$c
"23 /r   r
   c                       e Zd ZdZdZy)r   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(   r.   r/   r0   r1   r7   r   r   r   r   Z   s     Ir   r   c                   8     e Zd ZdZdZddee   ddf fdZ xZS )r   zRaised when the token is invalid.

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

            .. versionadded:: 20.0
    r7   Nr   r   c                 6    t         |   |d       y |       y )NzInvalid tokenr   r   r    r   r"   s     r   r   zInvalidToken.__init__r   s    GOIIr   r$   	r(   r.   r/   r0   r1   r   r2   r   r4   r5   s   @r   r   r   g   s/     IJ J J Jr   r   c                       e Zd ZdZdZy)r   af  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>`
    r7   Nr8   r7   r   r   r   r   v   s      Ir   r   c                       e Zd ZdZdZy)r   z=Raised when Telegram could not process the request correctly.r7   Nr8   r7   r   r   r   r      s
    GIr   r   c                   8     e Zd ZdZdZddee   ddf fdZ xZS )r   a  Raised 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
    r7   Nr   r   c                 ,    t         |   |xs d       y )Nz	Timed outr;   r<   s     r   r   zTimedOut.__init__   s    /K0r   r$   r=   r5   s   @r   r   r      s+    	 I1 1 1 1r   r   c                   H     e Zd ZdZdZdef fdZdeeee   f   fdZ	 xZ
S )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_idrC   c                 8    t         |   d|        || _        y )Nz+Group migrated to supergroup. New chat id: )r   r   rC   )r    rC   r"   s     r   r   zChatMigrated.__init__   s     F{mTU +r   r   c                 4    | j                   | j                  ffS r$   )r"   rC   r%   s    r   r,   zChatMigrated.__reduce__       ~~ 0 0222r   )r(   r.   r/   r0   r1   intr   r   r3   r,   r4   r5   s   @r   r   r      s5     !I,C ,3E$c
"23 3r   r   c                   H     e Zd ZdZdZdef fdZdeeee	   f   fdZ
 xZS )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_afterrI   c                 :    t         |   d| d       || _        y )Nz!Flood control exceeded. Retry in z seconds)r   r   rI   )r    rI   r"   s     r   r   zRetryAfter.__init__   s"    <[MRS +r   r   c                 4    | j                   | j                  ffS r$   )r"   rI   r%   s    r   r,   zRetryAfter.__reduce__   rF   r   )r(   r.   r/   r0   r1   rG   r   r   r3   floatr,   r4   r5   s   @r   r	   r	      s5     !I,C ,3E$e"45 3r   r	   c                   0    e Zd ZdZdZdeeee   f   fdZy)r   z>Raised when a long poll or webhook conflicts with another one.r7   r   c                 4    | j                   | j                  ffS r$   r+   r%   s    r   r,   zConflict.__reduce__   r-   r   N)	r(   r.   r/   r0   r1   r   r3   r2   r,   r7   r   r   r   r      s$    HI/E$c
"23 /r   r   c                   R     e Zd ZdZdZdeeef   f fdZde	e
e	e   f   fdZ xZS )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         |   d|        t        |      | _        y )NzPassportDecryptionError: )r   r   r2   rP   r<   s     r   r   z PassportDecryptionError.__init__   s#    4WI>?L	r   r   c                 4    | j                   | j                  ffS r$   )r"   rP   r%   s    r   r,   z"PassportDecryptionError.__reduce__   s    ~~		|++r   )r(   r.   r/   r0   r1   r   r2   	Exceptionr   r   r3   r,   r4   r5   s   @r   r   r      s>     I!c9n 5 !,E$c
"23 ,r   r   N)r0   __all__typingr   r   r   r2   r   rS   r
   r   r   r   r   r   r   r	   r   r   r7   r   r   <module>rV      s   & * )
@c 
@ 
@ 
@!/I !/H
 
J= J= ( 1| 1$3= 323 32/} /,m ,r   