a
    y{Jh!  ã                   @   sX  d dl mZmZ d dlmZ d dlmZ d dlmZ G dd„ de	ƒZ
G dd„ de
ƒZG d	d
„ d
e
ƒZG dd„ de
ƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZG d'd(„ d(e
ƒZd)S )*é    )ÚAnyÚOptional)ÚTelegramMethod)ÚTelegramType)Údocs_urlc                   @   s   e Zd ZdZdS )ÚAiogramErrorz0
    Base exception for all aiogram errors.
    N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úD/var/www/shaz/venv/lib/python3.9/site-packages/aiogram/exceptions.pyr      s   r   c                   @   sN   e Zd ZU dZdZee ed< eddœdd„Zedœdd	„Z	edœd
d„Z
dS )ÚDetailedAiogramErrorzF
    Base exception for all aiogram errors with detailed message.
    NÚurl)ÚmessageÚreturnc                 C   s
   || _ d S ©N©r   ©Úselfr   r   r   r   Ú__init__   s    zDetailedAiogramError.__init__©r   c                 C   s"   | j }| jr|d| j› d7 }|S )Nz
(background on this error at: ú))r   r   r   r   r   r   Ú__str__   s    zDetailedAiogramError.__str__c                 C   s   t | ƒj› d| › dS )Nz('z'))Útyper	   )r   r   r   r   Ú__repr__   s    zDetailedAiogramError.__repr__)r	   r
   r   r   r   r   ÚstrÚ__annotations__r   r   r   r   r   r   r   r      s
   
r   c                   @   s   e Zd ZdZdS )ÚCallbackAnswerExceptionz(
    Exception for callback answer.
    Nr   r   r   r   r   r   "   s   r   c                   @   s   e Zd ZdZdS )ÚSceneExceptionz
    Exception for scenes.
    Nr   r   r   r   r   r    (   s   r    c                   @   s   e Zd ZdZedddZdS )ÚUnsupportedKeywordArgumentzG
    Exception raised when a keyword argument is passed as filter.
    zmigration_2_to_3.htmlzfiltering-events)Z	fragment_N)r	   r
   r   r   r   r   r   r   r   r   r!   .   s   r!   c                       sN   e Zd ZU dZdZeed< ee eddœ‡ fdd„Z	edœ‡ fd	d
„Z
‡  ZS )ÚTelegramAPIErrorz5
    Base exception for all Telegram API errors.
    zTelegram server saysÚlabelN)Úmethodr   r   c                    s   t ƒ j|d || _d S )Nr   )Úsuperr   r$   )r   r$   r   ©Ú	__class__r   r   r   =   s    zTelegramAPIError.__init__r   c                    s   t ƒ  ¡ }| j› d|› S )Nz - )r%   r   r#   )r   Zoriginal_messager&   r   r   r   E   s    
zTelegramAPIError.__str__)r	   r
   r   r   r#   r   r   r   r   r   r   Ú__classcell__r   r   r&   r   r"   6   s   
ür"   c                   @   s   e Zd ZdZdZdS )ÚTelegramNetworkErrorz9
    Base exception for all Telegram network errors.
    zHTTP Client saysN)r	   r
   r   r   r#   r   r   r   r   r)   J   s   r)   c                       s4   e Zd ZdZdZee eeddœ‡ fdd„Z	‡  Z
S )ÚTelegramRetryAfterz6
    Exception raised when flood control exceeds.
    zOhttps://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-thisN)r$   r   Úretry_afterr   c                    sf   dt |ƒj›}t|dd ƒ }r.|d|› 7 }|d|› d7 }|d|› 7 }tƒ j||d || _d S )Nz!Flood control exceeded on method Úchat_idz	 in chat z. Retry in z	 seconds.ú
Original description: ©r$   r   )r   r	   Úgetattrr%   r   r+   )r   r$   r   r+   Údescriptionr,   r&   r   r   r   Y   s    zTelegramRetryAfter.__init__©r	   r
   r   r   r   r   r   r   Úintr   r(   r   r   r&   r   r*   R   s   ûr*   c                       s4   e Zd ZdZdZee eeddœ‡ fdd„Z	‡  Z
S )ÚTelegramMigrateToChatzG
    Exception raised when chat has been migrated to a supergroup.
    z5https://core.telegram.org/bots/api#responseparametersN)r$   r   Úmigrate_to_chat_idr   c                    sP   d|› }t |dd ƒ }r(|d|› 7 }|d|› 7 }tƒ j||d || _d S )Nz4The group has been migrated to a supergroup with id r,   z from r-   r.   )r/   r%   r   r4   )r   r$   r   r4   r0   r,   r&   r   r   r   p   s    
zTelegramMigrateToChat.__init__r1   r   r   r&   r   r3   i   s   ûr3   c                   @   s   e Zd ZdZdS )ÚTelegramBadRequestz5
    Exception raised when request is malformed.
    Nr   r   r   r   r   r5   ~   s   r5   c                   @   s   e Zd ZdZdS )ÚTelegramNotFoundzD
    Exception raised when chat, message, user, etc. not found.
    Nr   r   r   r   r   r6   „   s   r6   c                   @   s   e Zd ZdZdS )ÚTelegramConflictErrorza
    Exception raised when bot token is already used by another application in polling mode.
    Nr   r   r   r   r   r7   Š   s   r7   c                   @   s   e Zd ZdZdS )ÚTelegramUnauthorizedErrorz5
    Exception raised when bot token is invalid.
    Nr   r   r   r   r   r8      s   r8   c                   @   s   e Zd ZdZdS )ÚTelegramForbiddenErrorz?
    Exception raised when bot is kicked from chat or etc.
    Nr   r   r   r   r   r9   –   s   r9   c                   @   s   e Zd ZdZdS )ÚTelegramServerErrorzB
    Exception raised when Telegram server returns 5xx error.
    Nr   r   r   r   r   r:   œ   s   r:   c                   @   s   e Zd ZdZdS )ÚRestartingTelegrama/  
    Exception raised when Telegram server is restarting.

    It seems like this error is not used by Telegram anymore,
    but it's still here for backward compatibility.

    Currently, you should expect that Telegram can raise RetryAfter (with timeout 5 seconds)
     error instead of this one.
    Nr   r   r   r   r   r;   ¢   s   r;   c                   @   s   e Zd ZdZdZdS )ÚTelegramEntityTooLargezP
    Exception raised when you are trying to send a file that is too large.
    z0https://core.telegram.org/bots/api#sending-filesN)r	   r
   r   r   r   r   r   r   r   r<   ®   s   r<   c                   @   s2   e Zd ZdZeeeddœdd„Zedœdd„ZdS )	ÚClientDecodeErrorzX
    Exception raised when client can't decode response. (Malformed response, etc.)
    N)r   ÚoriginalÚdatar   c                 C   s   || _ || _|| _d S r   )r   r>   r?   )r   r   r>   r?   r   r   r   r   »   s    zClientDecodeError.__init__r   c              	   C   s4   t | jƒ}| j› d|j› d|j› d| j› d| j› 	S )Nz
Caused from error: Ú.z: z

Content: )r   r>   r   r
   r	   r?   )r   Úoriginal_typer   r   r   r   À   s    
þþþýÿzClientDecodeError.__str__)	r	   r
   r   r   r   Ú	Exceptionr   r   r   r   r   r   r   r=   ¶   s   r=   N)Útypingr   r   Zaiogram.methodsr   Zaiogram.methods.baser   Zaiogram.utils.linkr   rB   r   r   r   r    r!   r"   r)   r*   r3   r5   r6   r7   r8   r9   r:   r;   r<   r=   r   r   r   r   Ú<module>   s*   