
    i+'                    0   d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
 erddlmZmZ ddlmZ e
eef         ZddlmZ dZd	Z G d
 de          Z G d de          Z G d de          Z G d de          Zd1d2d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$ G d. d/e          Z%d0S )3a:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)DictListOptionalTYPE_CHECKINGAnyTupleUnion)ClientResponseClientWebSocketResponse)Response   )Interaction)DiscordExceptionClientExceptionGatewayNotFoundHTTPExceptionRateLimited	ForbiddenNotFoundDiscordServerErrorInvalidDataLoginFailureConnectionClosedPrivilegedIntentsRequiredInteractionRespondedMissingApplicationIDFFmpegProcessErrorzClient does not have an application_id set. Either the function was called before on_ready was called or application_id was not passed to the Client constructor.c                      e Zd ZdZdS )r   zBase exception class for discord.py

    Ideally speaking, this could be caught to handle any exceptions raised from this library.
    N__name__
__module____qualname____doc__     O/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/discord/errors.pyr   r   <            
 	Dr&   r   c                      e Zd ZdZdS )r   zException that's raised when an operation in the :class:`Client` fails.

    These are usually for exceptions that happened due to user input.
    Nr    r%   r&   r'   r   r   E   r(   r&   r   c                      e Zd ZdZdS )r   zUException that's raised when an FFmpeg process fails.

    .. versionadded:: 2.7
    Nr    r%   r&   r'   r   r   N   r(   r&   r   c                  "     e Zd ZdZ fdZ xZS )r   zKAn exception that is raised when the gateway for Discord could not be foundc                N    d}t                                          |           d S )Nz0The gateway to connect to discord was not found.)super__init__selfmessage	__class__s     r'   r.   zGatewayNotFound.__init__Z   s&    D!!!!!r&   r!   r"   r#   r$   r.   __classcell__r2   s   @r'   r   r   W   s>        UU" " " " " " " " "r&   r    dDict[str, Any]keystrreturnDict[str, str]c                   g }|                                  D ]\  }}|r|dz   |z   n|}t          |t                    r	 |d         }|                    |d                    d |D                       f           d# t
          $ r8 |                    t          ||                                                      Y w xY w|                    ||f           t          |          S )N._errors c              3  B   K   | ]}|                     d d          V  dS )r1   r6   N)get).0xs     r'   	<genexpr>z&_flatten_error_dict.<locals>.<genexpr>j   s0      /V/Vi0D0D/V/V/V/V/V/Vr&   )items
isinstancedictappendjoinKeyErrorextend_flatten_error_dict)r7   r9   rF   kvnew_keyr?   s          r'   rM   rM   _   s   #%E		 ' '1#&-#)a--Aa 	'Y01) gsxx/V/Vg/V/V/V'V'VWXXXX  F F F0G<<BBDDEEEEEF
 LL'1&&&&;;s   A;;?B=<B=c                  $     e Zd ZdZd fdZ xZS )r   a0  Exception that's raised when an HTTP request operation fails.

    Attributes
    ------------
    response: :class:`aiohttp.ClientResponse`
        The response of the failed HTTP request. This is an
        instance of :class:`aiohttp.ClientResponse`. In some cases
        this could also be a :class:`requests.Response`.

    text: :class:`str`
        The text of the error. Could be an empty string.
    status: :class:`int`
        The status code of the HTTP request.
    code: :class:`int`
        The Discord specific error code for the failure.
    response_ResponseTyper1   $Optional[Union[str, Dict[str, Any]]]c                   || _         |j        | _        |  |  t          |t                    r|                    dd          | _        |                    dd          }|                    d          }|| _        |rNt          |          }d                    d |	                                D                       }|dz   |z   | _
        n|| _
        n|pd| _
        d| _        d}t          | j
                  r|d	z  }t                                          |                    | j         | j        | j
                             d S )
Ncoder   r1   r6   errors
c              3      K   | ]	}d |z  V  
dS )z	In %s: %sNr%   )rC   ts     r'   rE   z)HTTPException.__init__.<locals>.<genexpr>   s&      #L#LK!O#L#L#L#L#L#Lr&   z'{0.status} {0.reason} (error code: {1})z: {2})rR   statusrG   rH   rB   rV   r?   rM   rJ   rF   textlenr-   r.   format)r0   rR   r1   baserW   helpfulfmtr2   s          r'   r.   zHTTPException.__init__   s+   '/#?gt$$ 	FA..DI;;y"--D[[**F5;DL !,V44))#L#LV\\^^#L#L#LLL 4K'1		 		2DIDI7ty>> 	7NCDM49diHHIIIIIr&   )rR   rS   r1   rT   r3   r5   s   @r'   r   r   q   sQ         "J J J J J J J J J Jr&   r   c                  $     e Zd ZdZd fdZ xZS )r   a0  Exception that's raised for when status code 429 occurs
    and the timeout is greater than the configured maximum using
    the ``max_ratelimit_timeout`` parameter in :class:`Client`.

    This is not raised during global ratelimits.

    Since sometimes requests are halted pre-emptively before they're
    even made, this **does not** subclass :exc:`HTTPException`.

    .. versionadded:: 2.0

    Attributes
    ------------
    retry_after: :class:`float`
        The amount of seconds that the client should wait before retrying
        the request.
    retry_afterfloatc                b    || _         t                                          d|dd           d S )NzToo many requests. Retry in z.2fz	 seconds.)rc   r-   r.   )r0   rc   r2   s     r'   r.   zRateLimited.__init__   s8    &RRRRRSSSSSr&   )rc   rd   r3   r5   s   @r'   r   r      sQ         $T T T T T T T T T Tr&   r   c                      e Zd ZdZdS )r   zcException that's raised for when status code 403 occurs.

    Subclass of :exc:`HTTPException`
    Nr    r%   r&   r'   r   r      r(   r&   r   c                      e Zd ZdZdS )r   zcException that's raised for when status code 404 occurs.

    Subclass of :exc:`HTTPException`
    Nr    r%   r&   r'   r   r      r(   r&   r   c                      e Zd ZdZdS )r   zException that's raised for when a 500 range status code occurs.

    Subclass of :exc:`HTTPException`.

    .. versionadded:: 1.5
    Nr    r%   r&   r'   r   r      s          	Dr&   r   c                      e Zd ZdZdS )r   zbException that's raised when the library encounters unknown
    or invalid data from Discord.
    Nr    r%   r&   r'   r   r      s          	Dr&   r   c                      e Zd ZdZdS )r   zException that's raised when the :meth:`Client.login` function
    fails to log you in from improper credentials or some other misc.
    failure.
    Nr    r%   r&   r'   r   r      r(   r&   r   c                  *     e Zd ZdZddd
 fd	Z xZS )r   aw  Exception that's raised when the gateway connection is
    closed for reasons that could not be handled internally.

    Attributes
    -----------
    code: :class:`int`
        The close code of the websocket.
    reason: :class:`str`
        The reason provided for the closure.
    shard_id: Optional[:class:`int`]
        The shard ID that got closed if applicable.
    N)rV   socketr   shard_idOptional[int]rV   c                   |p|j         pd| _        d| _        || _        t	                                          d| j         d| j                    d S )Nr6   z	Shard ID z WebSocket closed with )
close_coderV   reasonrm   r-   r.   )r0   rl   rm   rV   r2   s       r'   r.   zConnectionClosed.__init__   sZ     8!28b	'/VT]VV49VVWWWWWr&   )rl   r   rm   rn   rV   rn   r3   r5   s   @r'   r   r      sd          ko X X X X X X X X X X X Xr&   r   c                  $     e Zd ZdZd fdZ xZS )r   a  Exception that's raised when the gateway is requesting privileged intents
    but they're not ticked in the developer page yet.

    Go to https://discord.com/developers/applications/ and enable the intents
    that are required. Currently these are as follows:

    - :attr:`Intents.members`
    - :attr:`Intents.presences`
    - :attr:`Intents.message_content`

    Attributes
    -----------
    shard_id: Optional[:class:`int`]
        The shard ID that got closed if applicable.
    rm   rn   c                b    || _         d}t                                          ||z             d S )NaQ  Shard ID %s is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.)rm   r-   r.   )r0   rm   msgr2   s      r'   r.   z"PrivilegedIntentsRequired.__init__  s9    '/P 	 	x(((((r&   )rm   rn   r3   r5   s   @r'   r   r      sG          ) ) ) ) ) ) ) ) ) )r&   r   c                  $     e Zd ZdZd fdZ xZS )r   aZ  Exception that's raised when sending another interaction response using
    :class:`InteractionResponse` when one has already been done before.

    An interaction can only respond once.

    .. versionadded:: 2.0

    Attributes
    -----------
    interaction: :class:`Interaction`
        The interaction that's already been responded to.
    interactionr   c                X    || _         t                                          d           d S )Nz5This interaction has already been responded to before)rw   r-   r.   )r0   rw   r2   s     r'   r.   zInteractionResponded.__init__&  s*    (3PQQQQQr&   )rw   r   r3   r5   s   @r'   r   r     sQ         R R R R R R R R R Rr&   r   c                  &     e Zd ZdZdd fdZ xZS )r   a  An exception raised when the client does not have an application ID set.

    An application ID is required for syncing application commands and various
    other application tasks such as SKUs or application emojis.

    This inherits from :exc:`~discord.app_commands.AppCommandError`
    and :class:`~discord.ClientException`.

    .. versionadded:: 2.0

    .. versionchanged:: 2.5
        This is now exported to the ``discord`` namespace and now inherits from :class:`~discord.ClientException`.
    Nr1   Optional[str]c                X    t                                          |pt                     d S N)r-   r.   APP_ID_NOT_FOUNDr/   s     r'   r.   zMissingApplicationID.__init__:  s'    4$455555r&   r|   )r1   rz   r3   r5   s   @r'   r   r   +  sL         6 6 6 6 6 6 6 6 6 6 6r&   r   N)r6   )r7   r8   r9   r:   r;   r<   )&r$   
__future__r   typingr   r   r   r   r   r	   r
   aiohttpr   r   requestsr   rS   interactionsr   __all__r}   	Exceptionr   r   r   r   rM   r   r   r   r   r   r   r   r   r   r   r   r%   r&   r'   <module>r      s|   0 # " " " " " I I I I I I I I I I I I I I I I I I *????????!!!!!!.(23M))))))&M 	 	 	 	 	y 	 	 		 	 	 	 	& 	 	 		 	 	 	 	 	 	 	" " " " "& " " "    $*J *J *J *J *J$ *J *J *JZT T T T T" T T T0	 	 	 	 	 	 	 		 	 	 	 	} 	 	 		 	 	 	 	 	 	 		 	 	 	 	/ 	 	 		 	 	 	 	? 	 	 	X X X X X X X X0) ) ) ) ) ) ) )8R R R R R? R R R&6 6 6 6 6? 6 6 6 6 6r&   