
    cjh92                       d Z ddlmZ ddl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 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d;d<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! G d( d)e      Z" G d* d+e"      Z# G d, d-e"      Z$ G d. d/e"      Z% G d0 d1e"      Z& G d2 d3e"      Z' G d4 d5e      Z( G d6 d7e(      Z) G d8 d9e(      Z*y:# e$ r eZY  w xY w)=ae  
The MIT License (MIT)

Copyright (c) 2015-2021 Rapptz
Copyright (c) 2021-present Pycord Development

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)TYPE_CHECKINGAnyUnion)ClientResponseClientWebSocketResponse)Response   )Interaction)DiscordExceptionClientExceptionNoMoreItemsGatewayNotFoundValidationErrorHTTPException	ForbiddenNotFoundDiscordServerErrorInvalidDataInvalidArgumentLoginFailureConnectionClosedPrivilegedIntentsRequiredInteractionRespondedExtensionErrorExtensionAlreadyLoadedExtensionNotLoadedNoEntryPointErrorExtensionFailedExtensionNotFoundApplicationCommandErrorCheckFailureApplicationCommandInvokeErrorc                      e Zd ZdZy)r   zBase exception class for pycord

    Ideally speaking, this could be caught to handle any exceptions raised from this library.
    N__name__
__module____qualname____doc__     A/var/www/html/venv/lib/python3.12/site-packages/discord/errors.pyr   r   F       r+   r   c                      e Zd ZdZy)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   M   r-   r+   r   c                      e Zd ZdZy)r   zMException that is raised when an async iteration operation has no more items.Nr%   r*   r+   r,   r   r   T   s    Wr+   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                (    d}t         |   |       y )Nz0The gateway to connect to discord was not found.super__init__)selfmessage	__class__s     r,   r4   zGatewayNotFound.__init__[   s    D!r+   r&   r'   r(   r)   r4   __classcell__r7   s   @r,   r   r   X   s    U" "r+   r   c                      e Zd ZdZy)r   z=An Exception that is raised when there is a Validation Error.Nr%   r*   r+   r,   r   r   `   s    Gr+   r   c                x   g }| j                         D ]c  \  }}|r| d| n|}t        |t              r0	 |d   }|j                  |dj	                  d |D              f       Q|j                  ||f       e t        |      S # t
        $ r, |j                  t        ||      j                                Y w xY w)N._errors c              3  @   K   | ]  }|j                  d d        yw)r6    N)get).0xs     r,   	<genexpr>z&_flatten_error_dict.<locals>.<genexpr>o   s     /Vi0D/Vs   )items
isinstancedictappendjoinKeyErrorextend_flatten_error_dict)dkeyrF   kvnew_keyr>   s          r,   rM   rM   d   s    #%E	 '1"%SE1#,1aY01) gsxx/Vg/V'VWXLL'1&' ;  F0G<BBDEFs   B2B98B9c                  $     e Zd ZdZd fdZ xZS )r   a.  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.
    c                :   || _         |j                  | _        |  |  t        |t              r|j	                  dd      | _        |j	                  dd      }|j	                  d      }|r>t        |      }dj                  d |j                         D              }| d| | _	        n|| _	        n|xs d| _	        d| _        d}t        | j                        r|d	z  }t        | 1  |j                  | j                   | j
                  | j                               y )
Ncoder   r6   rA   errors
c              3  &   K   | ]	  }d |z    yw)z	In %s: %sNr*   )rC   ts     r,   rE   z)HTTPException.__init__.<locals>.<genexpr>   s     #LK!O#Ls   z'{0.status} {0.reason} (error code: {1})z: {2})responsestatusrG   rH   rB   rU   rM   rJ   rF   textlenr3   r4   format)r5   rZ   r6   baserV   helpfulfmtr7   s          r,   r4   zHTTPException.__init__   s    '/#??gt$FA.DI;;y"-D[[*F,V4))#LV\\^#LL#fBwi0	 	2DIDI7tyy>7NCDMM499diiHIr+   )rZ   _ResponseTyper6   zstr | dict[str, Any] | Noner8   r:   s   @r,   r   r   v   s    "J Jr+   r   c                      e Zd ZdZy)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y)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y)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    r+   r   c                      e Zd ZdZy)r   zbException that's raised when the library encounters unknown
    or invalid data from Discord.
    Nr%   r*   r+   r,   r   r      s    r+   r   c                      e Zd ZdZy)r   a  Exception that's raised when an argument to a function
    is invalid some way (e.g. wrong value or wrong type).

    This could be considered the parallel of ``ValueError`` and
    ``TypeError`` except inherited from :exc:`ClientException` and thus
    :exc:`DiscordException`.
    Nr%   r*   r+   r,   r   r      s    r+   r   c                      e Zd ZdZy)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                  4     e Zd ZdZdd	 	 	 	 	 d fdZ xZS )r   av  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)rU   c                   |xs |j                   xs d| _        d| _        || _        t        |   d| j                   d| j                          y )NrA   z	Shard ID z WebSocket closed with )
close_coderU   reasonshard_idr3   r4   )r5   socketrn   rU   r7   s       r,   r4   zConnectionClosed.__init__   sM     8!2!28b	$,9T]]O3J499+VWr+   )ro   r   rn   
int | NonerU   rp   r8   r:   s   @r,   r   r      s8    $  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.
    c                <    || _         d}t        | 	  ||z         y )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.)rn   r3   r4   )r5   rn   msgr7   s      r,   r4   z"PrivilegedIntentsRequired.__init__   s(    $,Q 	 	x(r+   )rn   rp   r8   r:   s   @r,   r   r      s     	) 	)r+   r   c                  $     e Zd ZdZd fdZ xZS )r   aY  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.
    c                2    || _         t        | 	  d       y )Nz5This interaction has already been responded to before)interactionr3   r4   )r5   rv   r7   s     r,   r4   zInteractionResponded.__init__  s    (3PQr+   )rv   r   r8   r:   s   @r,   r   r     s    R Rr+   r   c                  &     e Zd ZdZdd fdZ xZS )r   zBase exception for extension related errors.

    This inherits from :exc:`~discord.DiscordException`.

    Attributes
    ----------
    name: :class:`str`
        The extension that had an error.
    c                   || _         |xs d|d}|j                  dd      j                  dd      }t        |   |g|  y )N
Extension z had an error.z	@everyoneu   @​everyonez@hereu   @​here)namereplacer3   r4   )r5   r6   rz   argsmr7   s        r,   r4   zExtensionError.__init__)  sR    	@z$@OOK):;CC]
 	"T"r+   )N)r6   z
str | Noner|   r   rz   strreturnNoner8   r:   s   @r,   r   r     s    # #r+   r   c                  $     e Zd ZdZd fdZ xZS )r   zqAn exception raised when an extension has already been loaded.

    This inherits from :exc:`ExtensionError`
    c                0    t         |   d|d|       y )Nry   z is already loaded.rz   r2   r5   rz   r7   s     r,   r4   zExtensionAlreadyLoaded.__init__9  s    :dX-@AMr+   rz   r~   r   r   r8   r:   s   @r,   r   r   3  s    
N Nr+   r   c                  $     e Zd ZdZd fdZ xZS )r   zhAn exception raised when an extension was not loaded.

    This inherits from :exc:`ExtensionError`
    c                0    t         |   d|d|       y )Nry   z has not been loaded.r   r2   r   s     r,   r4   zExtensionNotLoaded.__init__C  s    :dX-BC$Or+   r   r8   r:   s   @r,   r   r   =  s    
P Pr+   r   c                  $     e Zd ZdZd fdZ xZS )r   zAn exception raised when an extension does not have a ``setup`` entry point function.

    This inherits from :exc:`ExtensionError`
    c                0    t         |   d|d|       y )Nry   z has no 'setup' function.r   r2   r   s     r,   r4   zNoEntryPointError.__init__M  s    :dX-FGdSr+   r   r8   r:   s   @r,   r   r   G  s    
T Tr+   r   c                  $     e Zd ZdZd fdZ xZS )r   a  An exception raised when an extension failed to load during execution of the module or ``setup`` entry point.

    This inherits from :exc:`ExtensionError`

    Attributes
    ----------
    name: :class:`str`
        The extension that had the error.
    original: :exc:`Exception`
        The original exception that was raised. You can also get this via
        the ``__cause__`` attribute.
    c                t    || _         d|d|j                  j                   d| }t        |   ||       y )Nry   z raised an error: : r   )originalr7   r&   r3   r4   )r5   rz   r   rs   r7   s       r,   r4   zExtensionFailed.__init___  sN    #+ 283E3E3N3N2O Pz 	 	4(r+   )rz   r~   r   	Exceptionr   r   r8   r:   s   @r,   r   r   Q  s    ) )r+   r   c                  $     e Zd ZdZd fdZ xZS )r    a  An exception raised when an extension is not found.

    This inherits from :exc:`ExtensionError`

    .. versionchanged:: 1.3
        Made the ``original`` attribute always None.

    Attributes
    ----------
    name: :class:`str`
        The extension that had the error.
    c                4    d|d}t         |   ||       y )Nry   z could not be found.r   r2   )r5   rz   rs   r7   s      r,   r4   zExtensionNotFound.__init__v  s$    4("674(r+   r   r8   r:   s   @r,   r    r    h  s    ) )r+   r    c                      e Zd ZdZy)r!   a6  The base exception type for all application command related errors.

    This inherits from :exc:`DiscordException`.

    This exception and exceptions inherited from it are handled
    in a special way as they are caught and passed into a special event
    from :class:`.Bot`\, :func:`.on_command_error`.
    Nr%   r*   r+   r,   r!   r!   {  s    r+   r!   c                      e Zd ZdZy)r"   zException raised when the predicates in :attr:`.Command.checks` have failed.

    This inherits from :exc:`ApplicationCommandError`
    Nr%   r*   r+   r,   r"   r"     r-   r+   r"   c                  $     e Zd ZdZd fdZ xZS )r#   a-  Exception raised when the command being invoked raised an exception.

    This inherits from :exc:`ApplicationCommandError`

    Attributes
    ----------
    original: :exc:`Exception`
        The original exception that was raised. You can also get this via
        the ``__cause__`` attribute.
    c                f    || _         t        | 	  d|j                  j                   d|        y )Nz)Application Command raised an exception: r   )r   r3   r4   r7   r&   )r5   er7   s     r,   r4   z&ApplicationCommandInvokeError.__init__  s3    #$78L8L7MRPQsS	
r+   )r   r   r   r   r8   r:   s   @r,   r#   r#     s    	
 
r+   r#   N)rA   )rN   zdict[str, Any]rO   r~   r   zdict[str, str])+r)   
__future__r   typingr   r   r   aiohttpr   r   requestsr	   rb   ModuleNotFoundErrorinteractionsr   __all__r   r   r   r   r   r   rM   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r*   r+   r,   <module>r      s  2 # , ,?'%nh67 *8y & X" X"& "H& H$)J$ )JX }  / o ? X X<) ):R? R&#% #*N^ NP PT T)n ).) )&. * 
$; 
Q  '&'s   E EE