o
    HEDi/:                     @   s:  d Z ddlZg dZdd ZG dd deZG dd	 d	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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 d0d1 d1eZG d2d3 d3eZG d4d5 d5eZG d6d7 d7eZG d8d9 d9eZG d:d; d;eZ G d<d= d=eZ!G d>d? d?eZ"G d@dA dAe"Z#G dBdC dCe"Z$G dDdE dEe"Z%G dFdG dGe"Z&G dHdI dIe"Z'G dJdK dKe"Z(G dLdM dMeZ)G dNdO dOeeZ*G dPdQ dQeeZ+G dRdS dSeZ,G dTdU dUeZ-G dVdW dWeZ.G dXdY dYeZ/G dZd[ d[eZ0G d\d] d]eZ1G d^d_ d_eZ2G d`da daeZ3G dbdc dceZ4G ddde deeZ5G dfdg dgeZ6G dhdi dieZ7G djdk dkeZ8G dldm dmeZ9G dndo doeZ:G dpdq dqeZ;G drds dseZ<G dtdu dueZ=G dvdw dweZ>G dxdy dyeZ?G dzd{ d{eZ@G d|d} d}eZAG d~d deZBG dd deZCG dd deZDG dd deZEG dd deZFG dd deZGG dd deZHG dd deZIG dd deZJG dd deJZKG dd deJZLG dd deJZMG dd deJZNG dd deZOG dd deZPG dd deZQG dd deZRG dd deZSG dd deZTG dd deZUG dd deZVG dd deeZWG dd deWZXG dd deeZYG dd deYZZG dd deYZ[G dd deeZ\G dd de\Z]G dd de\Z^G dd de\Z_G dd de\Z`G dd de\ZaG dd deZbG dd deZcG ddÄ deZdG ddń deZeG ddǄ deZfdS )ab
  
- TelegramAPIError
    - ValidationError
    - Throttled
    - BadRequest
        - MessageError
            - MessageNotModified
            - MessageToForwardNotFound
            - MessageIdInvalid
            - MessageToDeleteNotFound
            - MessageToPinNotFound
            - MessageIdentifierNotSpecified
            - MessageTextIsEmpty
            - MessageCantBeEdited
            - MessageCantBeDeleted
            - MessageCantBeForwarded
            - MessageToEditNotFound
            - MessageToReplyNotFound
            - ToMuchMessages
        - PollError
            - PollCantBeStopped
            - PollHasAlreadyClosed
            - PollsCantBeSentToPrivateChats
            - PollSizeError
                - PollMustHaveMoreOptions
                - PollCantHaveMoreOptions
                - PollsOptionsLengthTooLong
                - PollOptionsMustBeNonEmpty
                - PollQuestionMustBeNonEmpty
            - MessageWithPollNotFound (with MessageError)
            - MessageIsNotAPoll (with MessageError)
        - ObjectExpectedAsReplyMarkup
        - InlineKeyboardExpected
        - ChatNotFound
        - ChatDescriptionIsNotModified
        - InvalidQueryID
        - InvalidPeerID
        - InvalidHTTPUrlContent
        - ButtonURLInvalid
        - URLHostIsEmpty
        - StartParamInvalid
        - ButtonDataInvalid
        - FileIsTooBig
        - WrongFileIdentifier
        - GroupDeactivated
        - BadWebhook
            - WebhookRequireHTTPS
            - BadWebhookPort
            - BadWebhookAddrInfo
            - BadWebhookNoAddressAssociatedWithHostname
        - NotFound
            - MethodNotKnown
        - PhotoAsInputFileRequired
        - InvalidStickersSet
        - NoStickerInRequest
        - ChatAdminRequired
        - NeedAdministratorRightsInTheChannel
        - MethodNotAvailableInPrivateChats
        - CantDemoteChatCreator
        - CantRestrictSelf
        - NotEnoughRightsToRestrict
        - PhotoDimensions
        - UnavailableMembers
        - TypeOfFileMismatch
        - WrongRemoteFileIdSpecified
        - PaymentProviderInvalid
        - CurrencyTotalAmountInvalid
        - CantParseUrl
        - UnsupportedUrlProtocol
        - CantParseEntities
        - ResultIdDuplicate
        - MethodIsNotAvailable
    - ConflictError
        - TerminatedByOtherGetUpdates
        - CantGetUpdates
    - Unauthorized
        - BotKicked
        - BotBlocked
        - UserDeactivated
        - CantInitiateConversation
        - CantTalkWithBots
    - NetworkError
    - RetryAfter
    - MigrateToChat
    - RestartingTelegram

- AIOGramWarning
    - TimeoutWarning
    N)zerror: z	[error]: zbad request: z
conflict: znot found: c                 C   s@   t D ]}| |r| t|d  } q| d  | dd    S )Nr      )	_PREFIXES
startswithlenupperstrip)textprefix r
   g/var/www/www-root/data/www/ovozai.pdev.uz/venv/lib/python3.10/site-packages/aiogram/utils/exceptions.py_clean_messagec   s
   
r   c                       s   e Zd Zd fdd	Z  ZS )TelegramAPIErrorNc                    s   t t| t| d S N)superr   __init__r   )selfmessage	__class__r
   r   r   k   s   zTelegramAPIError.__init__r   __name__
__module____qualname__r   __classcell__r
   r
   r   r   r   j   s    r   c                       sF   e Zd ZdZdZg Z fddZedefddZ	edd	 Z
  ZS )
_MatchErrorMixin Nc                    s>   t t| jdi | t| d| j ds| j|  d S d S )N___groupr
   )r   r   __init_subclass__hasattrr   _MatchErrorMixin__subclassesappend)clskwargsr   r
   r   r   u   s   z"_MatchErrorMixin.__init_subclass__returnc                 C   s   | j  |v S )zy
        Compare pattern with message

        :param message: always must be in lowercase
        :return: bool
        )matchlower)r"   r   r
   r
   r   check{   s   z_MatchErrorMixin.checkc                 C   s>   |  }| jD ]}|| u rq||r|| jp|q| |r   )r&   r    r'   r   )r"   descriptionerrr
   r
   r   detect   s   

z_MatchErrorMixin.detect)r   r   r   r%   r   r    r   classmethodboolr'   r*   r   r
   r
   r   r   r   o   s    	r   c                   @      e Zd ZdS )AIOGramWarningNr   r   r   r
   r
   r
   r   r.          r.   c                   @   r-   )TimeoutWarningNr/   r
   r
   r
   r   r1      r0   r1   c                   @   r-   )FSMStorageWarningNr/   r
   r
   r
   r   r2      r0   r2   c                   @   r-   )ValidationErrorNr/   r
   r
   r
   r   r3      r0   r3   c                   @      e Zd ZdZdS )
BadRequestTN)r   r   r   _BadRequest__groupr
   r
   r
   r   r5          r5   c                   @   r4   )MessageErrorTN)r   r   r   _MessageError__groupr
   r
   r
   r   r8      r7   r8   c                   @      e Zd ZdZdZdS )MessageNotModifiedzP
    Will be raised when you try to set new text is equals to current text.
    zmessage is not modifiedNr   r   r   __doc__r%   r
   r
   r
   r   r;          r;   c                   @   r:   )MessageToForwardNotFoundzX
    Will be raised when you try to forward very old or deleted or unknown message.
    zmessage to forward not foundNr<   r
   r
   r
   r   r?      r>   r?   c                   @   r:   )MessageIdInvalidzInvalid message idmessage_id_invalidN)r   r   r   r   r%   r
   r
   r
   r   r@          r@   c                   @   r:   )MessageToDeleteNotFoundzW
    Will be raised when you try to delete very old or deleted or unknown message.
    zmessage to delete not foundNr<   r
   r
   r
   r   rC      r>   rC   c                   @   r:   )MessageToPinNotFoundzH
    Will be raised when you try to pin deleted or unknown message.
    zmessage to pin not foundNr<   r
   r
   r
   r   rD      r>   rD   c                   @   r:   )MessageToReplyNotFoundzY
    Will be raised when you try to reply to very old or deleted or unknown message.
    zReply message not foundNr<   r
   r
   r
   r   rE      r>   rE   c                   @   r4   )MessageIdentifierNotSpecifiedz#message identifier is not specifiedNr   r   r   r%   r
   r
   r
   r   rF      r7   rF   c                   @   r4   )MessageTextIsEmptyzMessage text is emptyNrG   r
   r
   r
   r   rH      r7   rH   c                   @   r4   )MessageCantBeEditedzmessage can't be editedNrG   r
   r
   r
   r   rI      r7   rI   c                   @   r4   )MessageCantBeDeletedzmessage can't be deletedNrG   r
   r
   r
   r   rJ      r7   rJ   c                   @   r4   )MessageCantBeForwardedzmessage can't be forwardedNrG   r
   r
   r
   r   rK      r7   rK   c                   @   r4   )MessageToEditNotFoundzmessage to edit not foundNrG   r
   r
   r
   r   rL      r7   rL   c                   @   r4   )MessageIsTooLongzmessage is too longNrG   r
   r
   r
   r   rM      r7   rM   c                   @   r:   )ToMuchMessageszR
    Will be raised when you try to send media group with more than 10 items.
    z%Too much messages to send as an albumNr<   r
   r
   r
   r   rN      r>   rN   c                   @   r4   )ObjectExpectedAsReplyMarkupzobject expected as reply markupNrG   r
   r
   r
   r   rO      r7   rO   c                   @   r4   )InlineKeyboardExpectedzinline keyboard expectedNrG   r
   r
   r
   r   rP      r7   rP   c                   @   r4   )	PollErrorTN)r   r   r   _PollError__groupr
   r
   r
   r   rQ      r7   rQ   c                   @   r4   )PollCantBeStoppedzpoll can't be stoppedNrG   r
   r
   r
   r   rS      r7   rS   c                   @   r4   )PollHasAlreadyBeenClosedzpoll has already been closedNrG   r
   r
   r
   r   rT     r7   rT   c                   @   r4   )PollsCantBeSentToPrivateChatsz$polls can't be sent to private chatsNrG   r
   r
   r
   r   rU     r7   rU   c                   @   r4   )PollSizeErrorTN)r   r   r   _PollSizeError__groupr
   r
   r
   r   rV     r7   rV   c                   @   r4   )PollMustHaveMoreOptionsz poll must have at least 2 optionNrG   r
   r
   r
   r   rX     r7   rX   c                   @   r4   )PollCantHaveMoreOptionsz$poll can't have more than 10 optionsNrG   r
   r
   r
   r   rY     r7   rY   c                   @   r4   )PollOptionsMustBeNonEmptyzpoll options must be non-emptyNrG   r
   r
   r
   r   rZ     r7   rZ   c                   @   r4   )PollQuestionMustBeNonEmptyzpoll question must be non-emptyNrG   r
   r
   r
   r   r[     r7   r[   c                   @   r4   )PollOptionsLengthTooLongz'poll options length must not exceed 100NrG   r
   r
   r
   r   r\     r7   r\   c                   @   r4   )PollQuestionLengthTooLongz(poll question length must not exceed 255NrG   r
   r
   r
   r   r]   #  r7   r]   c                   @   r4   )$PollCanBeRequestedInPrivateChatsOnlyz+Poll can be requested in private chats onlyNrG   r
   r
   r
   r   r^   '  r7   r^   c                   @   r:   )MessageWithPollNotFoundL
    Will be raised when you try to stop poll with message without poll
    z#message with poll to stop not foundNr<   r
   r
   r
   r   r_   +  r>   r_   c                   @   r:   )MessageIsNotAPollr`   zmessage is not a pollNr<   r
   r
   r
   r   ra   2  r>   ra   c                   @   r4   )ChatNotFoundzchat not foundNrG   r
   r
   r
   r   rb   9  r7   rb   c                   @   r4   )ChatIdIsEmptyzchat_id is emptyNrG   r
   r
   r
   r   rc   =  r7   rc   c                   @   r:   )InvalidUserIduser_id_invalidzInvalid user idNr   r   r   r%   r   r
   r
   r
   r   rd   A  rB   rd   c                   @   r4   )ChatDescriptionIsNotModifiedz chat description is not modifiedNrG   r
   r
   r
   r   rg   F  r7   rg   c                   @   r4   )InvalidQueryIDzDquery is too old and response timeout expired or query id is invalidNrG   r
   r
   r
   r   rh   J  r7   rh   c                   @   r:   )InvalidPeerIDPEER_ID_INVALIDzInvalid peer IDNrf   r
   r
   r
   r   ri   N  rB   ri   c                   @   r4   )InvalidHTTPUrlContentzFailed to get HTTP URL contentNrG   r
   r
   r
   r   rk   S  r7   rk   c                   @   r:   )ButtonURLInvalidBUTTON_URL_INVALIDzButton URL invalidNrf   r
   r
   r
   r   rl   W  rB   rl   c                   @   r4   )URLHostIsEmptyzURL host is emptyNrG   r
   r
   r
   r   rn   \  r7   rn   c                   @   r:   )StartParamInvalidSTART_PARAM_INVALIDzStart param invalidNrf   r
   r
   r
   r   ro   `  rB   ro   c                   @   r:   )ButtonDataInvalidBUTTON_DATA_INVALIDzButton data invalidNrf   r
   r
   r
   r   rq   e  rB   rq   c                   @   r4   )FileIsTooBigzFile is too bigNrG   r
   r
   r
   r   rs   j  r7   rs   c                   @   r4   )WrongFileIdentifierz(wrong file identifier/HTTP URL specifiedNrG   r
   r
   r
   r   rt   n  r7   rt   c                   @   r4   )GroupDeactivatedzGroup chat was deactivatedNrG   r
   r
   r
   r   ru   r  r7   ru   c                   @   r:   )PhotoAsInputFileRequiredzE
    Will be raised when you try to set chat photo from file ID.
    z(Photo should be uploaded as an InputFileNr<   r
   r
   r
   r   rv   v  r>   rv   c                   @   r:   )InvalidStickersSetSTICKERSET_INVALIDzStickers set is invalidNrf   r
   r
   r
   r   rw   }  rB   rw   c                   @   r4   )NoStickerInRequestz"there is no sticker in the requestNrG   r
   r
   r
   r   ry     r7   ry   c                   @   r:   )ChatAdminRequiredCHAT_ADMIN_REQUIREDAdmin permissions is required!Nrf   r
   r
   r
   r   rz     rB   rz   c                   @   r:   )#NeedAdministratorRightsInTheChannelz-need administrator rights in the channel chatr|   Nrf   r
   r
   r
   r   r}     rB   r}   c                   @   r4   )NotEnoughRightsToPinMessagez"not enough rights to pin a messageNrG   r
   r
   r
   r   r~     r7   r~   c                   @   r4   ) MethodNotAvailableInPrivateChatsz4method is available only for supergroups and channelNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )CantDemoteChatCreatorzcan't demote chat creatorNrG   r
   r
   r
   r   r     r7   r   c                   @   r:   )CantRestrictSelfzcan't restrict selfzAdmin can't restrict self.Nrf   r
   r
   r
   r   r     rB   r   c                   @   r4   )NotEnoughRightsToRestrictz4not enough rights to restrict/unrestrict chat memberNrG   r
   r
   r
   r   r     r7   r   c                   @   r:   )PhotoDimensionsPHOTO_INVALID_DIMENSIONSzInvalid photo dimensionsNrf   r
   r
   r
   r   r     rB   r   c                   @   r4   )UnavailableMembersz"supergroup members are unavailableNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )TypeOfFileMismatchztype of file mismatchNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )WrongRemoteFileIdSpecifiedzwrong remote file id specifiedNrG   r
   r
   r
   r   r     r7   r   c                   @   r:   )PaymentProviderInvalidPAYMENT_PROVIDER_INVALIDzpayment provider invalidNrf   r
   r
   r
   r   r     rB   r   c                   @   r:   )CurrencyTotalAmountInvalidcurrency_total_amount_invalidzcurrency total amount invalidNrf   r
   r
   r
   r   r     rB   r   c                   @   r4   )
BadWebhookTN)r   r   r   _BadWebhook__groupr
   r
   r
   r   r     r7   r   c                   @      e Zd ZdZde ZdS )WebhookRequireHTTPSz&HTTPS url must be provided for webhookbad webhook: Nrf   r
   r
   r
   r   r         r   c                   @   r   )BadWebhookPortz7Webhook can be set up only on ports 80, 88, 443 or 8443r   Nrf   r
   r
   r
   r   r     r   r   c                   @   r   )BadWebhookAddrInfoz1getaddrinfo: Temporary failure in name resolutionr   Nrf   r
   r
   r
   r   r     r   r   c                   @   r4   ))BadWebhookNoAddressAssociatedWithHostnamez;failed to resolve host: no address associated with hostnameNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )CantParseUrlzcan't parse URLNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )UnsupportedUrlProtocolzunsupported URL protocolNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )CantParseEntitieszcan't parse entitiesNrG   r
   r
   r
   r   r     r7   r   c                   @   r:   )ResultIdDuplicateresult_id_duplicatezResult ID duplicateNrf   r
   r
   r
   r   r     rB   r   c                   @   r:   )BotDomainInvalidbot_domain_invalidzInvalid bot domainNrf   r
   r
   r
   r   r     rB   r   c                   @   r4   )MethodIsNotAvailablez(Method is available only for supergroupsNrG   r
   r
   r
   r   r     r7   r   c                   @   r:   )CantRestrictChatOwnerz2
    Raises when bot restricts the chat owner
    zCan't remove chat ownerNr<   r
   r
   r
   r   r     r>   r   c                   @   r:   )UserIsAnAdministratorOfTheChatz2
    Raises when bot restricts the chat admin
    z$User is an administrator of the chatNr<   r
   r
   r
   r   r     r>   r   c                   @   r4   )NotFoundTN)r   r   r   _NotFound__groupr
   r
   r
   r   r     r7   r   c                   @   r4   )MethodNotKnownzmethod not foundNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )ConflictErrorTN)r   r   r   _ConflictError__groupr
   r
   r
   r   r     r7   r   c                   @   r:   )TerminatedByOtherGetUpdatesz&terminated by other getUpdates requestzWTerminated by other getUpdates request; Make sure that only one bot instance is runningNrf   r
   r
   r
   r   r     rB   r   c                   @   r4   )CantGetUpdatesz3can't use getUpdates method while webhook is activeNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )UnauthorizedTN)r   r   r   _Unauthorized__groupr
   r
   r
   r   r     r7   r   c                   @   r4   )	BotKickedzbot was kicked fromNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )
BotBlockedzbot was blocked by the userNrG   r
   r
   r
   r   r     r7   r   c                   @   r4   )UserDeactivatedzuser is deactivatedNrG   r
   r
   r
   r   r   !  r7   r   c                   @   r4   )CantInitiateConversationz+bot can't initiate conversation with a userNrG   r
   r
   r
   r   r   %  r7   r   c                   @   r4   )CantTalkWithBotszbot can't send messages to botsNrG   r
   r
   r
   r   r   )  r7   r   c                   @   r-   )NetworkErrorNr/   r
   r
   r
   r   r   -  r0   r   c                          e Zd Z fddZ  ZS )RestartingTelegramc                    s   t t| d d S )Nz<The Telegram Bot API service is restarting. Wait few second.)r   r   r   r   r   r
   r   r   2  s   zRestartingTelegram.__init__r   r
   r
   r   r   r   1      r   c                       r   )
RetryAfterc                    "   t t| d| d || _d S )Nz!Flood control exceeded. Retry in z	 seconds.)r   r   r   timeout)r   retry_afterr   r
   r   r   7     
zRetryAfter.__init__r   r
   r
   r   r   r   6  r   r   c                       r   )MigrateToChatc                    r   )Nz5The group has been migrated to a supergroup. New id: .)r   r   r   migrate_to_chat_id)r   chat_idr   r
   r   r   =  r   zMigrateToChat.__init__r   r
   r
   r   r   r   <  r   r   c                   @   s   e Zd Zdd Zdd ZdS )	Throttledc                 K   s   ddl m}m}m}m}m}m} ||d| _||t		 | _
||d | _||d| _||d| _||d| _|dd | _|dd | _d S )N   )DELTAEXCEEDED_COUNTKEY	LAST_CALL
RATE_LIMITRESULTz<None>Fr   userchat)dispatcher.storager   r   r   r   r   r   popkeytime	called_atrateresultexceeded_countdeltar   r   )r   r#   r   r   r   r   r   r   r
   r
   r   r   C  s    zThrottled.__init__c                 C   s$   d| j  d| j dt| jd dS )NzRate limit exceeded! (Limit: z s, exceeded: z, time delta:    z s))r   r   roundr   r   r
   r
   r   __str__N  s
   

zThrottled.__str__N)r   r   r   r   r   r
   r
   r
   r   r   B  s    r   )gr=   r   r   r   	Exceptionr   r   Warningr.   r1   r2   r3   r5   r8   r;   r?   r@   rC   rD   rE   rF   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rS   rT   rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   ra   rb   rc   rd   rg   rh   ri   rk   rl   rn   ro   rq   rs   rt   ru   rv   rw   ry   rz   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r
   r
   r   <module>   s    Y!