
    iH             	         d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZ ddlZddlmZ ddlmZmZmZmZ dd	lmZm Z  dd
l!m"Z" ddl#m$Z$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZA erOddlBmCZCmDZDmEZE ddlFmGZG ddlHmIZI ddlJmKZK ddl!mLZL ddlMmNZN ddlOmPZP ddlQmRZR ddlSmTZT eeGe(geeedf         f         ZUdZVer eCd          ZWn ed          ZW ed          ZX eded ef         !          ZY ed"d#!          ZZeeeeXf         Z[ed$e(ge[e         f         Z\eeeZd$e(ge[e         f         e\f         Z]ed$gee^e[e^         f         f         Z_ed%         Z`ereeeDeZd$eWf         e[eX         f         eeDd$eWf         e[eX         f         f         Zaeed$e7ge[e         f         ed$e5ge[e         f         ed$e3ge[e         f         ed$ee7e5f         ge[e         f         f         ZbeeeZd$ecge[ee"eL                           f         ed$ecge[ee"eL                           f         f         Zdn0ed e[eX         f         Zaed e[eX         f         Zbed e[eX         f         Zded&d'd(ebf         Zed)Zfd*Zg ejh        d+efz   egz   d,z             Zid-Zjd.Zkd/Zl ejh        d0ej d1el d2ek ejm                  Zn ejh        d3ej d4ek ejm                  Zo ejh        d0ej d5el d6ek ejm                  Zpdd=Zqdd@ZrddAZsddDZte&dEddKZuddOZvddRZwddUZxddWZyddYZzdd\Z{dd]Z| G d^ d_          Z} G d` daeeZeWeXf                   Z~ G db d'          Z G dc dd          Ze<e<dedfe<dgddpZe<dedfe<dqddsZddvZddwZddyZddzZdd}ZddZeddd            Zedd            ZdddZeddd            Zedd            ZdddZeddd            Zedd            ZdddZe<e<e<fddZeddd            Zedd            ZdddZeddd            Zedd            ZdddZe<e<fddZdddZdS )a:  
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.
    )annotationsN)AnyCallableClassVar	CoroutineDict	GeneratorGenericListMutableMappingOptionalSetTYPE_CHECKINGTupleTypeTypeVarUnionoverload)copy   )AppCommandOptionTypeAppCommandTypeChannelTypeLocale   )AppCommandContextAppInstallationType)Choice)annotation_to_parameterCommandParameterNoneType)AppCommandErrorCheckFailureCommandInvokeErrorCommandSignatureMismatchCommandAlreadyRegistered)TranslationContextLocationTranslationContext
Translator
locale_str)Message)User)MemberPermissions)resolve_annotationMISSINGis_inside_classmaybe_coroutine	async_all_shorten_to_kebab_case)	ParamSpecConcatenateUnpack)Interaction)	Snowflake)	Namespace)ChoiceT)CommandTree)ClientT)commands)_PermissionsKwargs)CommandContextMenuGroup	Parametercontext_menucommanddescribecheckrenamechoicesautocompleteguilds
guild_onlydm_onlyprivate_channel_onlyallowed_contextsguild_installuser_installallowed_installsdefault_permissionsPTF.)boundGroupTBindingzInteraction[Any])rD   zcommands.CogCommand[Any, ..., Any]rC   zCommandCallback[Any, ..., Any]z\u0e31-\u0e3a\u0e47-\u0e4ezV\u0900-\u0903\u093a\u093b\u093c\u093e\u093f\u0940-\u094f\u0955\u0956\u0957\u0962\u0963z^[-_\wz]{1,32}$z(?:\\?\*){0,2}(?P<name>\w+)z3(?P<description>(?:.|\n)+?(?:\Z|\r?\n(?=[\S\r\n])))z(?:.+)^z[ \t]*(?:\(z\))?[ \t]*:[ \t]*z^:param z:[ \t]+z(?:[ \t]*:)?(?:[ \t]+z)?[ \t]*\r?\n[ \t]+funcCallable[..., Any]paramsDict[str, CommandParameter]returnDict[str, str]c                p   t          j        |           }|i S t          j        d                    d |                                D                                 }t
                              |          t                              |          t                              |          f}fd|D             S )N
c              3  D   K   | ]}|                     d           |V  dS )z  N)
startswith).0lines     ^/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/discord/app_commands/commands.py	<genexpr>z-_parse_args_from_docstring.<locals>.<genexpr>   s7      .p.pZ^ZiZijnZoZo.pt.p.p.p.p.p.p    c                    i | ]G}|D ]B}|                     d           v |                     d           |                     d          CHS )namedescription)group)rh   matchesmr`   s      rj   
<dictcomp>z._parse_args_from_docstring.<locals>.<dictcomp>   sf       4;Y` TUdedkdklrdsdsw}d}d}//d}d}d}d}rl   )	inspectgetdoccleandocjoin
splitlinesGOOGLE_DOCSTRING_ARG_REGEXfinditerSPHINX_DOCSTRING_ARG_REGEXNUMPY_DOCSTRING_ARG_REGEX)r^   r`   	docstringsection_linesdocstring_styless    `   rj   _parse_args_from_docstringr      s    t$$I	
 $TYY.p.p	@T@T@V@V.p.p.p%p%pqqM"++M::"++I66!**955   ?O   rl   rn   strc                    t                               |           }|t          | d          |                                 | k    rt          | d          | S )Nzg must be between 1-32 characters and contain only lower-case letters, numbers, hyphens, or underscores.z must be all lower-case)VALID_SLASH_COMMAND_NAMEmatch
ValueErrorlower)rn   r   s     rj   validate_namer      si    $**400E}~~~
 
 	
 zz||tD;;;<<<Krl   c                N    | rt          |           dk    rt          d          | S )N    z2context menu names must be between 1-32 characters)lenr   rn   s    rj   validate_context_menu_namer      s-     O3t99r>>MNNNKrl   callback%AutocompleteCallback[GroupT, ChoiceT]c                    t          | dd           }|d u ot          |           }||| _        d|z   }t          j        |           j        }t          |          |k    rt          d| j        d          | S )N__self__r   zautocomplete callback z/ requires either 2 or 3 parameters to be passed)	getattrr2   pass_command_bindingrt   	signature
parametersr   	TypeError__qualname__)r   bindingr   required_parametersr`   s        rj   validate_auto_complete_callbackr      s     h
D11G"d?Hx/H/H (<%22x((3F
6{{)))y1FyyyzzzOrl   )_none
annotationr   r   typer   c               D   | t           u rt          j        S t          t          h| v rt          j        S t          | dd           }|t          urd| d}t          |          t          fd| j
        D                       st          d|           t          j        S )N
__origin__zunsupported type annotation zt, must be either discord.Member, discord.User, discord.Message, or a typing.Union of discord.Member and discord.Userc              3      K   | ]}|v V  	d S N )rh   argsupported_typess     rj   rk   z+_context_menu_annotation.<locals>.<genexpr>  s(      EE#so%EEEEEErl   zunsupported types given inside )r+   r   messager-   r,   userr   r   r   all__args__)r   r   originmsgr   s       @rj   _context_menu_annotationr      s    W%%!'O_$$"" Zt44FUb: b b b 	 nn EEEE1DEEEEE JH*HHIIIrl   descriptionsDict[str, Any]Nonec                   |                                  D ]\  }}|                    |t                    }|t          u rd|_        1t	          |t
          t          f          st          d          t	          |t
                    rt          |          |_        ||_        |r.t          t          |                    }t          d|           d S )N   …zdescription must be a stringunknown parameter given: )itemspopr1   ro   
isinstancer   r*   r   r5   nextiter)r`   r   rn   paramro   firsts         rj   _populate_descriptionsr     s    ||~~ , ,e"&&tW55'!! %E+Z'899 	<:;;;k3'' 	, ( 5 5E +E =T,''((;E;;<<<= =rl   renames!Dict[str, Union[str, locale_str]]c                   i }|                                  D ]}|                    |t                    }|t          u r|||<   ,||v rt          | d          t	          |t
                    rt          |          }nt          |j                   |||<   || |         _        |r.t          t          |                    }t          d|           d S )Nz is already usedr   )keysr   r1   r   r   r   r   r   _renamer   r   )r`   r   
rename_maprn   new_namer   s         rj   _populate_renamesr   "  s    46J  ( (;;tW--w#Jt::::;;;h$$ 	,$X..HH(*+++#
4't >T']]##<U<<===> >rl   all_choicesDict[str, List[Choice]]c                R   |                                  D ]\  }|                    |t                    }|t          u r*t          |t                    st          d          t          d |D                       st          d          j        t          j	        t          j
        t          j        fvrt          d          t          fd|D                       st          d          |_        |r.t          t          |                    }t          d|           d S )Nz choices must be a list of Choicec              3  @   K   | ]}t          |t                    V  d S r   )r   r   )rh   choices     rj   rk   z$_populate_choices.<locals>.<genexpr>G  s,      DD&:ff--DDDDDDrl   zFchoices are only supported for integer, string, or number option typesc              3  8   K   | ]}j         |j        k    V  d S r   )r   _option_type)rh   r   r   s     rj   rk   z$_populate_choices.<locals>.<genexpr>M  s-      KK5:!44KKKKKKrl   zMchoices must all have the same inner option type as the parameter choice typer   )r   r   r1   r   listr   r   r   r   stringnumberintegerrK   r   r   )r`   r   rn   rK   r   r   s        @rj   _populate_choicesr   >  s;   ||~~    e//$00g'4(( 	@>???DDGDDDDD 	@>???:29;O;VXlXtuuudeeeKKKK7KKKKK 	mklll =T+&&'';E;;<<<= =rl   rL   c                
   |                                  D ]\  }}|                    |t                    }|t          u r*t          j        |          st          d          |j        t          j        t          j	        t          j
        fvrt          d          |                                rt          d          t          |          |_        |r.t          t          |                    }t          d|           d S )Nz2autocomplete callback must be a coroutine functionJautocomplete is only supported for integer, string, or number option typesfChoice annotation unsupported for autocomplete parameters, consider using a regular annotation insteadr   )r   r   r1   rt   iscoroutinefunctionr   r   r   r   r   r   is_choice_annotationr   rL   r   r   )r`   rL   rn   r   r   r   s         rj   _populate_autocompleter   W  s   ||~~ G Ge##D'22w*844 	RPQQQ:29;O;VXlXtuuuhiii%%'' 	x   =XFF =T,''((;E;;<<<= =rl   globalnsc                   t          j        |           j        }i }t          |           dz   }t	          |          |k     rt          d| j        d|dz
   d          t          |                                          }t          d|          D ]}t          |           g }|D ]k}|j        |j        u rt          d|j        d| j                  t          |j        |||          }	t          |	|          }
|                    |
           lt#          |d d	
          }d |D             }t%          | |          }	 |                    | j                   n*# t*          $ r |D ]}
|
j        t.          u rd|
_        Y nw xY w|rt1          ||           	 | j        }t5          ||                                           n# t*          $ r Y nw xY w	 | j        }t;          ||                                           n# t*          $ r Y nw xY w	 | j        }t?          ||                                           n# t*          $ r Y nw xY w|S )Nr   z	callback z must have more than z parameter(s)r   z
parameter z* is missing a type annotation in callback c                    | j         S r   )required)as    rj   <lambda>z3_extract_parameters_from_callback.<locals>.<lambda>  s    aj rl   T)keyreversec                    i | ]
}|j         |S r   r   )rh   vs     rj   rs   z5_extract_parameters_from_callback.<locals>.<dictcomp>  s    (((Aafa(((rl   r   ) rt   r   r   r2   r   r   r   r   valuesranger   r   emptyrn   r0   r   appendsortedr   update*__discord_app_commands_param_description__AttributeErrorro   r1   r   %__discord_app_commands_param_rename__r   r   &__discord_app_commands_param_choices__r   +__discord_app_commands_param_autocomplete__r   )r^   r   r`   cacherequired_paramsiterator_r   	parameterresolvedr   r   resultr   r   rK   rL   s                    rj   !_extract_parameters_from_callbackr   o  s   t$$/FE%d++a/O
6{{_$$pD$5ppo`aNapppqqqFMMOO$$H1o&&  X)+J ! !	9?22zzzeievzz{{{%i&:HhPUVV')<<%    J$8$8$GGGF(((((F-dF;;L*DKLLLL * * * 	* 	*E G++$)!	* 	**  5v|4442< 	&',,..1111    
2= 	&',,..1111    
<G 	v|'8'8':':;;;;    
 MsH   E $FFG 
GGG? ?
HHH: :
IIContextMenuCallbackTuple[str, Any, AppCommandType]c                ,   t          j        |           j        }t          |           rt	          | d          st          d          t          |          dk    rd| j        d}t          |          t          |	                                          }t          |           t          |          }|j        |j        u rd| j        d}t          |          t          |j        | j        | j        i           }t          |          }|j        ||fS )Nr   z.context menus cannot be defined inside a classr   zcontext menu callback z requires 2 parameters, the first one being the interaction and the other one explicitly annotated with either discord.Message, discord.User, discord.Member, or a typing.Union of discord.Member and discord.Userz*second parameter of context menu callback z must be explicitly annotated with either discord.Message, discord.User, discord.Member, or a typing.Union of discord.Member and discord.User)rt   r   r   r2   hasattrr   r   r   r   r   r   r   r   r0   __globals__r   rn   )r^   r`   r   r   r   r   r   s          rj   _get_context_menu_parameterr     s,   t$$/Ft JWT:%>%> JHIII
6{{aCT%6 C C C 	 nnFMMOO$$HNNNXIy..@9J @ @ @ 	
 nn!)"68H$JZ\^__H#H--DNHd++rl   c                    d | _         | S r   )&__discord_app_commands_base_function__r^   s    rj   mark_overrideabler     s    26D/Krl   c                  j   e Zd ZdZd dZed!d	            Zed"d            Zed"d            Zed#d            Z	ed"d            Z
ed$d            Zed$d            Zed#d            Zed%d            Zed&d            Zed'd            Zed(d            Zed)d            Zed)d            ZdS )*rE   a  A class that contains the parameter information of a :class:`Command` callback.

    .. versionadded:: 2.0

    Attributes
    -----------
    name: :class:`str`
        The name of the parameter. This is the Python identifier for the parameter.
    display_name: :class:`str`
        The displayed name of the parameter on Discord.
    description: :class:`str`
        The description of the parameter.
    autocomplete: :class:`bool`
        Whether the parameter has an autocomplete handler.
    locale_name: Optional[:class:`locale_str`]
        The display name's locale string, if available.
    locale_description: Optional[:class:`locale_str`]
        The description's locale string, if available.
    required: :class:`bool`
        Whether the parameter is required
    choices: List[:class:`~discord.app_commands.Choice`]
        A list of choices this parameter takes, if any.
    type: :class:`~discord.AppCommandOptionType`
        The underlying type of this parameter.
    channel_types: List[:class:`~discord.ChannelType`]
        The channel types that are allowed for this parameter.
    min_value: Optional[Union[:class:`int`, :class:`float`]]
        The minimum supported value for this parameter.
    max_value: Optional[Union[:class:`int`, :class:`float`]]
        The maximum supported value for this parameter.
    default: Any
        The default value of the parameter, if given.
        If not given then this is :data:`~discord.utils.MISSING`.
    command: :class:`Command`
        The command this parameter is attached to.
    parentr    rG   r\   rb   r   c                "    || _         || _        d S r   )_Parameter__parent_Parameter__command)selfr   rG   s      rj   __init__zParameter.__init__  s    *018rl   c                    | j         S r   )r   r   s    rj   rG   zParameter.command  s
    ~rl   r   c                    | j         j        S r   )r   rn   r  s    rj   rn   zParameter.name      }!!rl   c                    | j         j        S r   )r   display_namer  s    rj   r  zParameter.display_name  s    }))rl   boolc                    | j         j        S r   )r   r   r  s    rj   r   zParameter.required  s    }%%rl   c                4    t          | j        j                  S r   )r   r   ro   r  s    rj   ro   zParameter.description  s    4=,---rl   Optional[locale_str]c                \    t          | j        j        t                    r| j        j        S d S r   )r   r   r   r*   r  s    rj   locale_namezParameter.locale_name
  s)    dm+Z88 	)=((trl   c                \    t          | j        j        t                    r| j        j        S d S r   )r   r   ro   r*   r  s    rj   locale_descriptionzParameter.locale_description  s)    dm/<< 	-=,,trl   c                    | j         j        d uS r   )r   rL   r  s    rj   rL   zParameter.autocomplete  s    })55rl   r   c                    | j         j        S r   )r   defaultr  s    rj   r  zParameter.default  s    }$$rl   r   c                    | j         j        S r   )r   r   r  s    rj   r   zParameter.type  r  rl   $List[Choice[Union[int, float, str]]]c                X    | j         j        }|t          u rg S |                                S r   )r   rK   r1   r   )r   rK   s     rj   rK   zParameter.choices"  s*    -'gI||~~rl   List[ChannelType]c                X    | j         j        }|t          u rg S |                                S r   )r   channel_typesr1   r   )r   r  s     rj   r  zParameter.channel_types)  s.    3G##I!!###rl   Optional[Union[int, float]]c                    | j         j        S r   )r   	min_valuer  s    rj   r  zParameter.min_value0      }&&rl   c                    | j         j        S r   )r   	max_valuer  s    rj   r  zParameter.max_value4  r  rl   N)r   r    rG   r\   rb   r   )rb   r\   rb   r   rb   r  )rb   r
  )rb   r   )rb   r   )rb   r  )rb   r  )rb   r  )__name__
__module__r   __doc__r   propertyrG   rn   r  r   ro   r  r  rL   r  r   rK   r  r  r  r   rl   rj   rE   rE     s       # #J9 9 9 9    X " " " X" * * * X* & & & X& . . . X.    X
    X
 6 6 6 X6 % % % X% " " " X"    X $ $ $ X$ ' ' ' X' ' ' ' X' ' 'rl   rE   c                  $   e Zd ZdZddddddeddOdZdPdZdQdZedRd             Z	edd!dSd'Z
dTd-ZdUd.ZdVd3ZdWd4ZdXd7ZdYd:ZdZd;Zd[d<Zd\d>Zed]d@            Zd^dBZed_dC            Zed`dD            ZdadEZdbdHZdcdJZdddMZdddNZdS )erB   a  A class that implements an application command.

    These are usually not created manually, instead they are created using
    one of the following decorators:

    - :func:`~discord.app_commands.command`
    - :meth:`Group.command <discord.app_commands.Group.command>`
    - :meth:`CommandTree.command <discord.app_commands.CommandTree.command>`

    .. versionadded:: 2.0

    Parameters
    -----------
    name: Union[:class:`str`, :class:`locale_str`]
        The name of the application command.
    description: Union[:class:`str`, :class:`locale_str`]
        The description of the application command. This shows up in the UI to describe
        the application command.
    callback: :ref:`coroutine <coroutine>`
        The coroutine that is executed when the command is called.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.
        Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent application command. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.

    Attributes
    ------------
    name: :class:`str`
        The name of the application command.
    description: :class:`str`
        The description of the application command. This shows up in the UI to describe
        the application command.
    checks
        A list of predicates that take a :class:`~discord.Interaction` parameter
        to indicate whether the command callback should be executed. If an exception
        is necessary to be thrown to signal failure, then one inherited from
        :exc:`AppCommandError` should be used. If all the checks fail without
        propagating an exception, :exc:`CheckFailure` is raised.
    default_permissions: Optional[:class:`~discord.Permissions`]
        The default permissions that can execute this command on Discord. Note
        that server administrators can override this value in the client.
        Setting an empty permissions field will disallow anyone except server
        administrators from using the command in a guild.

        Due to a Discord limitation, this does not work on subcommands.
    guild_only: :class:`bool`
        Whether the command should only be usable in guild contexts.

        Due to a Discord limitation, this does not work on subcommands.
    allowed_contexts: Optional[:class:`~discord.app_commands.AppCommandContext`]
        The contexts that the command is allowed to be used in.
        Overrides ``guild_only`` if this is set.

        .. versionadded:: 2.4
    allowed_installs: Optional[:class:`~discord.app_commands.AppInstallationType`]
        The installation contexts that the command is allowed to be installed
        on.

        .. versionadded:: 2.4
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent application command. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    FNT)nsfwr   	guild_idsrQ   rT   auto_locale_stringsextrasrn   Union[str, locale_str]ro   r   CommandCallback[GroupT, P, T]r%  r  r   Optional[Group]r&  Optional[List[int]]rQ   Optional[AppCommandContext]rT   Optional[AppInstallationType]r'  r(  Dict[Any, Any]c       
           t          |t                    r	|j        |fn|d f\  }}t          |          | _        || _        t          |t                    r	|j        |fn|d f\  }}|| _        || _        d | _        || _	        || _
        d | _        d | _        |j        | _        	 |j        | _        |j        x| _	        }n# t"          $ r Y nw xY wt%          ||j                  | _        t+          |dg           | _        || _        | j        t+          |dd           | _        t+          |dd           | _        t+          |dd          | _        |pt+          |dd           | _        |pt+          |dd           | _        || _        |
pi | _        | j        | j
        t=          d          |	r|                                  d S d S )	N__discord_app_commands_checks__'__discord_app_commands_default_guilds__,__discord_app_commands_default_permissions__#__discord_app_commands_guild_only__F!__discord_app_commands_contexts__+__discord_app_commands_installation_types__zZchild commands cannot have default guilds set, consider setting them in the parent instead) r   r*   r   r   rn   _locale_namero   _locale_description_attr	_callbackr   r   on_errorr!  moduler   __func__r   r   r   _paramsr   checks
_guild_idsrU   rN   rQ   rT   r%  r(  r   _convert_to_locale_strings)r   rn   ro   r   r%  r   r&  rQ   rT   r'  r(  locales               rj   r   zCommand.__init__  s     0:$
/K/K]d++RVX\Q]f&t,,	282<[*2U2Un[ +..\gim[n 	V !,9? $(
8@'-)-15%-%8	#,DL(0(99DNXX 	 	 	D	 5VV^`h`t4u4u#*85VXZ#[#[/8?"%h0Y[_``DO:ADd;
 ;
  !(2WY^ _ _=M >
QX94R
 R
 @P @
SZCTT
 T
 	&,l?&4;+Byzzz 	.++-----	. 	.s   $B? ?
CCrb   r   c                    | j         t          | j                  | _         | j        t          | j                  | _        | j                                        D ]}|                                 d S r   )r7  r*   rn   r8  ro   r>  r   rA  )r   r   s     rj   rA  z"Command._convert_to_locale_strings  su    $ *49 5 5D#+'1$2B'C'CD$\((** 	/ 	/E,,....	/ 	/rl   owner	Type[Any]r   c                    || _         d S r   )r9  r   rD  rn   s      rj   __set_name__zCommand.__set_name__  s    


rl   c                    | j         S )zX:ref:`coroutine <coroutine>`: The coroutine that is executed when the command is called.r:  r  s    rj   r   zCommand.callback       ~rl   bindingsset_on_bindingr   rZ   rM  MutableMapping[GroupT, GroupT]rN  c                   |t           u ri n|}t          |           }| j                                        |_        ||_        | j        |                    | j                  n||_        |j        r|rt          |j        |j        |           |S r   )	r1   shallow_copyr>  r   r   r   getr9  setattr)r   r   r   rM  rN  r   s         rj   
_copy_withzCommand._copy_with  s     "W,,22(D!!|((**59\5Mx||DL111SZ: 	4. 	4DL$*d333rl   treeCommandTree[ClientT]
translatorr)   r   c                   K                         |          }i }i }t          t          j                   }t          t          j                   }t
          D ]l} j        r.                     j        ||           d {V }	|	
|	||j        <    j	        r.                     j	        ||           d {V }	|	
|	||j        <   m||d<   ||d<    fd j
                                        D              d {V |d<   |S )Nlocationdataname_localizationsdescription_localizationsc           	     h   K   g | ],}|                     t          |                     d {V -S r   )get_translated_payloadrE   )rh   r   r   rW  s     rj   
<listcomp>z2Command.get_translated_payload.<locals>.<listcomp>  sV       
 
 
W\%..z9UD;Q;QRRRRRRRR
 
 
rl   options)to_dictr(   r'   command_namecommand_descriptionr   r7  _checked_translatevaluer8  r>  r   
r   rU  rW  baser\  r]  name_contextdescription_contextrB  translations
   ` `       rj   r_  zCommand.get_translated_payload  s}     ||D!!-/46! *3M3Zaefff0:T:hosttt 		J 		JF  C$.$A$A$BSU[]i$j$jjjjjjj*7B&v|4' J$.$A$A$BZ\bdw$x$xxxxxxx*>I-fl;%7!",E()
 
 
 
 
`d`l`s`s`u`u
 
 
 
 
 
 
 
 
Y rl   c                   | j         t          j        j        nt          j        j        }| j        | j        |d | j        	                                D             d}| j         q| j
        |d<   | j         |d<   | j        d n| j        j        |d<   |j                            | j                  |d<   |j                            | j                  |d<   |S )Nc                6    g | ]}|                                 S r   rb  rh   r   s     rj   r`  z#Command.to_dict.<locals>.<listcomp>  s     KKKEKKKrl   rn   ro   r   ra  r%  dm_permissiondefault_member_permissionscontextsintegration_types)r   r   
chat_inputrf  r   
subcommandrn   ro   r>  r   r%  rN   rU   rQ   _merge_to_arrayrT   r   rU  option_typerh  s       rj   rb  zCommand.to_dict	  s     :>9Ln/55RfRqRwI+KKT\5H5H5J5JKKK	 
  
 ;9DL(,$7D!9=9Q9Y_c_w_}D-.#4DDTEZ[[D(,(=(M(MdNc(d(dD$%rl   interactionr:   errorr"   c                  K   | j         F| j        #|                      | j        ||           d {V  n|                      ||           d {V  | j        }|D|                     ||           d {V  |j        !|j                             ||           d {V  t          | j        dd           }| |||           d {V  d S d S )N&__discord_app_commands_error_handler__)r;  r   r   r   )r   rz  r{  r   binding_error_handlers        rj   _invoke_error_handlerszCommand._invoke_error_handlers  s     =$|'mmDL+uEEEEEEEEEEmmK777777777//+u555555555}(m,,[%@@@@@@@@@ '6^`d e e ,''U;;;;;;;;;;; -,rl   c                    | j         dS | j        }|:t          |j         d          sdS |j        t          |j        j         d          sdS t          | j        dd           dS dS )NTr   r}  F)r;  r   r   r   r   r   r   s     rj   _has_any_error_handlerszCommand._has_any_error_handlers0  s|    =$46?,TUU t}(v}57_``  4 4<!I4PP\4url   	namespacer<   c                &  K   |j         }i }| j                                        D ]k}	 ||j                 }|                    ||           d {V ||j        <   5# t          $ r* |j        s|j        ||j        <   nt          |           d Y hw xY w|S r   )
__dict__r>  r   r  	transformrn   KeyErrorr   r  r%   )r   rz  r  r   transformed_valuesr   rf  s          rj   _transform_argumentszCommand._transform_argumentsD  s      #\((** 		[ 		[E[u12 8={TY7Z7Z1Z1Z1Z1Z1Z1Z"5:..  C C C~ C5:]&uz222488dB 32C "!s   A1BBr`   rW   c                  K   	 | j          | j        | j         |fi | d {V S  | j        |fi | d {V S # t          $ r`}t          j                    d         j        }|j                            d          | u rt          |           d t          | |          |d }~wt          $ r  t          $ r}t          | |          |d }~ww xY w)Nr   )r   r:  r   rt   traceframef_localsrR  r%   r$   r"   	Exception)r   rz  r`   er  s        rj   _do_callzCommand._do_callU  s     	5|'+T^DL+PPPPPPPPPPP'>>v>>>>>>>>> 	5 	5 	5 MOOB'-E~!!&))T11.t44$>$T1--14 	 	 	 	5 	5 	5$T1--14	5s&    9 9 
CABC5CCc                   K   |                      |           d {V st          d| j        d          |                     ||           d {V }|                     ||           d {V S )Nz The check functions for command  failed.)_check_can_runr#   rn   r  r  )r   rz  r  r  s       rj   _invoke_with_namespacezCommand._invoke_with_namespaceo  s      ((55555555 	YW$)WWWXXX#'#<#<[)#T#TTTTTTT]];0BCCCCCCCCCrl   c                  K   |j         |         }	 | j        |         }n[# t          $ rN d | j                                        D             }	 ||         }n# t          $ r t	          |           d w xY wY nw xY w|j        t	          |           t          |j        dg           }|rr	 t          fd|D                        d {V }n# t          $ r d}Y nw xY w|s;j	        
                                s j	                            g            d {V  d S t          |j        dd          r6| j        }	|	|                    |	|           d {V }
n+t          d          |                    |           d {V }
j	        
                                rd S j	                            |
           d {V  d S )Nc                    i | ]
}|j         |S r   )r  ro  s     rj   rs   z0Command._invoke_autocomplete.<locals>.<dictcomp>  s    SSSEe(%SSSrl   r1  c              3  .   K   | ]} |          V  d S r   r   rh   frz  s     rj   rk   z/Command._invoke_autocomplete.<locals>.<genexpr>  s+      (L(LA;(L(L(L(L(L(Lrl   Fr   zOautocomplete parameter expected a bound self parameter but one was not provided)r  r>  r  r   r%   rL   r   r4   r  responseis_doner   r   )r   rz  rn   r  rf  r   r`   
predicatespassedr   rK   s    `         rj   _invoke_autocompletezCommand._invoke_autocompletev  s_      "4(	?L&EE 	? 	? 	?SST\=P=P=R=RSSSF?t ? ? ?.t44$>? 		? %*4000U/1RTVWW
 		((L(L(L(L(L(L(LLLLLLLLL     "+3355 @%.;;B?????????5%'=uEE 	ClG" % 2 27K O OOOOOOO qrrr!..{EBBBBBBBBG'')) 	F"//88888888888s9     -A8AA8A22A87A8*!C CCOptional[Union[Command, Group]]c                    d S r   r   r   rn   s     rj   _get_internal_commandzCommand._get_internal_command  s    trl   List[Parameter]c                N      fd j                                         D             S )zReturns a list of parameters for this command.

        This does not include the ``self`` or ``interaction`` parameters.

        Returns
        --------
        List[:class:`Parameter`]
            The parameters of this command.
        c                0    g | ]}t          |          S r   )rE   )rh   pr   s     rj   r`  z&Command.parameters.<locals>.<listcomp>  s#    BBBq	!T""BBBrl   )r>  r   r  s   `rj   r   zCommand.parameters  s.     CBBBDL,?,?,A,ABBBBrl   Optional[Parameter]c                ^    | j                             |          }|t          ||           S dS )a  Retrieves a parameter by its name.

        The name must be the Python identifier rather than the renamed
        one for display on Discord.

        Parameters
        -----------
        name: :class:`str`
            The parameter name in the callback function.

        Returns
        --------
        Optional[:class:`Parameter`]
            The parameter or ``None`` if not found.
        N)r>  rR  rE   )r   rn   r   s      rj   get_parameterzCommand.get_parameter  s4    " !!$''VT***trl   c                4    | j         dS | j         }|j         p|S )z:Optional[:class:`Group`]: The root parent of this command.Nr   r  s     rj   root_parentzCommand.root_parent  s%     ;4}&&rl   c                    | j         | j        S | j        | j         j        g}| j         j         }||                    |j                   d                    t	          |                    S )z:class:`str`: Returns the fully qualified command name.

        The qualified name includes the parent name as well. For example,
        in a command like ``/foo bar`` the qualified name is ``foo bar``.
        N )r   rn   r   rw   reversed)r   namesgrandparents      rj   qualified_namezCommand.qualified_name  sb     ;9DK,-k("LL)***xx(((rl   c                @  K   | j         0| j         | j        ur"t          | j         j                   d {V sdS | j        2t	          | j        dd           }|rt          |           d {V }|sdS | j        }|sdS t          fd|D                        d {V S )NFinteraction_checkTc              3  .   K   | ]} |          V  d S r   r   r  s     rj   rk   z)Command._check_can_run.<locals>.<genexpr>  +      BB!qq~~BBBBBBrl   )r   r   r3   r  r   r?  r4   )r   rz  rI   retr  s    `   rj   r  zCommand._check_can_run  s      ;"t{$,'F'F ))FTTTTTTTT u<#%,T\;NPT%U%UE !+E;???????? ! 5[
 	4BBBBzBBBBBBBBBBBBrl   coroError[GroupT]c                Z    t          j        |          st          d          || _        |S aw  A decorator that registers a coroutine as a local error handler.

        The local error handler is called whenever an exception is raised in the body
        of the command or during handling of the command. The error handler must take
        2 parameters, the interaction and the error.

        The error passed will be derived from :exc:`AppCommandError`.

        Parameters
        -----------
        coro: :ref:`coroutine <coroutine>`
            The coroutine to register as the local error handler.

        Raises
        -------
        TypeError
            The coroutine passed is not actually a coroutine.
        &The error handler must be a coroutine.rt   r   r   r;  r   r  s     rj   r{  zCommand.error  3    ( *400 	FDEEErl   XCallable[[AutocompleteCallback[GroupT, ChoiceT]], AutocompleteCallback[GroupT, ChoiceT]]c                     d fd}|S )a%  A decorator that registers a coroutine as an autocomplete prompt for a parameter.

        The coroutine callback must have 2 parameters, the :class:`~discord.Interaction`,
        and the current value by the user (the string currently being typed by the user).

        To get the values from other parameters that may be filled in, accessing
        :attr:`.Interaction.namespace` will give a :class:`Namespace` object with those
        values.

        Parent :func:`checks <check>` are ignored within an autocomplete. However, checks can be added
        to the autocomplete callback and the ones added will be called. If the checks fail for any reason
        then an empty list is sent as the interaction response.

        The coroutine decorator **must** return a list of :class:`~discord.app_commands.Choice` objects.
        Only up to 25 objects are supported.

        .. warning::
            The choices returned from this coroutine are suggestions. The user may ignore them and input their own value.

        Example:

        .. code-block:: python3

            @app_commands.command()
            async def fruits(interaction: discord.Interaction, fruit: str):
                await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')

            @fruits.autocomplete('fruit')
            async def fruits_autocomplete(
                interaction: discord.Interaction,
                current: str,
            ) -> List[app_commands.Choice[str]]:
                fruits = ['Banana', 'Pineapple', 'Apple', 'Watermelon', 'Melon', 'Cherry']
                return [
                    app_commands.Choice(name=fruit, value=fruit)
                    for fruit in fruits if current.lower() in fruit.lower()
                ]


        Parameters
        -----------
        name: :class:`str`
            The parameter name to register as autocomplete.

        Raises
        -------
        TypeError
            The coroutine passed is not actually a coroutine or
            the parameter is not found or of an invalid type.
        r  r   rb   c                   t          j        |           st          d          	 j                 }n!# t          $ r t          d          d w xY w|j        t          j        t          j        t          j	        fvrt          d          |
                                rt          d          t          |           |_        | S )Nz7The autocomplete callback must be a coroutine function.zunknown parameter: r   r   )rt   r   r   r>  r  r   r   r   r   r   r   r   rL   )r  r   rn   r   s     rj   	decoratorz'Command.autocomplete.<locals>.decoratorL  s    .t44 [ YZZZJT* J J J >d > >??TIJ z"6"=?S?Z\p\x!yyy lmmm))++ |   "A!F!FEKs	   4 A)r  r   rb   r   r   )r   rn   r  s   `` rj   rL   zCommand.autocomplete  s0    l	 	 	 	 	 	 	( rl   r^   Checkc               :    | j                             |           dS zAdds a check to the command.

        This is the non-decorator interface to :func:`check`.

        Parameters
        -----------
        func
            The function that will be used as a check.
        Nr?  r   r   r^   s     rj   	add_checkzCommand.add_checkb        	4     rl   c               ^    	 | j                             |           dS # t          $ r Y dS w xY wa  Removes a check from the command.

        This function is idempotent and will not raise an exception
        if the function is not in the command's checks.

        Parameters
        -----------
        func
            The function to remove from the checks.
        Nr?  remover   r  s     rj   remove_checkzCommand.remove_checko  E    	Kt$$$$$ 	 	 	DD	    
,,)rn   r)  ro   r)  r   r*  r%  r  r   r+  r&  r,  rQ   r-  rT   r.  r'  r  r(  r/  rb   r   rD  rE  rn   r   rb   r   )rb   r*  )
r   r+  r   rZ   rM  rO  rN  r  rb   rB   rU  rV  rW  r)   rb   r   rU  rV  rb   r   )rz  r:   r{  r"   rb   r   r  )rz  r:   r  r<   rb   r   )rz  r:   r`   r   rb   rW   )rz  r:   r  r<   rb   rW   )rz  r:   rn   r   r  r<   )rn   r   rb   r  )rb   r  )rn   r   rb   r  rb   r+  r  rz  r:   rb   r  )r  r  rb   r  )rn   r   rb   r  r^   r  rb   r   )r   r!  r   r"  r1   r   rA  rH  r#  r   rT  r_  rb  r  r  r  r  r  r  r  r   r  r  r  r  r{  rL   r  r  r   rl   rj   rB   rB   9  sc       P Pp "&)-8<:>$(!(;. ;. ;. ;. ;. ;.z/ / / /       X 4;#     (   6   (< < < <&   (" " " ""5 5 5 54D D D D*9 *9 *9 *9X    
C 
C 
C X
C   , ' ' ' X' ) ) ) X)(C C C C.   4J J J JX! ! ! !     rl   rB   c                      e Zd ZdZedddddedd2dZed3d            Zed4d            Zd5d!Z	d6d"Z
d7d%Zd8d&Zd9d)Zd:d,Zd;d0Zd;d1ZdS )<rC   a  A class that implements a context menu application command.

    These are usually not created manually, instead they are created using
    one of the following decorators:

    - :func:`~discord.app_commands.context_menu`
    - :meth:`CommandTree.context_menu <discord.app_commands.CommandTree.context_menu>`

    .. versionadded:: 2.0

    Parameters
    -----------
    name: Union[:class:`str`, :class:`locale_str`]
        The name of the context menu.
    callback: :ref:`coroutine <coroutine>`
        The coroutine that is executed when the command is called.
    type: :class:`.AppCommandType`
        The type of context menu application command. By default, this is inferred
        by the parameter of the callback.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.
        Defaults to ``False``.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.

    Attributes
    ------------
    name: :class:`str`
        The name of the context menu.
    type: :class:`.AppCommandType`
        The type of context menu application command. By default, this is inferred
        by the parameter of the callback.
    default_permissions: Optional[:class:`~discord.Permissions`]
        The default permissions that can execute this command on Discord. Note
        that server administrators can override this value in the client.
        Setting an empty permissions field will disallow anyone except server
        administrators from using the command in a guild.
    guild_only: :class:`bool`
        Whether the command should only be usable in guild contexts.
        Defaults to ``False``.
    allowed_contexts: Optional[:class:`~discord.app_commands.AppCommandContext`]
        The contexts that this context menu is allowed to be used in.
        Overrides ``guild_only`` if set.

        .. versionadded:: 2.4
    allowed_installs: Optional[:class:`~discord.app_commands.AppInstallationType`]
        The installation contexts that the command is allowed to be installed
        on.

        .. versionadded:: 2.4
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.
        Defaults to ``False``.
    checks
        A list of predicates that take a :class:`~discord.Interaction` parameter
        to indicate whether the command callback should be executed. If an exception
        is necessary to be thrown to signal failure, then one inherited from
        :exc:`AppCommandError` should be used. If all the checks fail without
        propagating an exception, :exc:`CheckFailure` is raised.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    FNT)r   r%  r&  rQ   rT   r'  r(  rn   r)  r   r   r   r   r%  r  r&  r,  rQ   r-  rT   r.  r'  r(  r/  c       	           t          |t                    r	|j        |fn|d f\  }}
t          |          | _        |
| _        || _        t          |          \  }}}|t          u r|}||k    rt          d| d| d          || _
        || _        || _        |j        | _        || _        | j        t!          |dd           | _        d | _        t!          |dd           | _        || _        t!          |dd          | _        |pt!          |dd           | _        |pt!          |d	d           | _        t!          |d
g           | _        |	pi | _        |r"| j        t          | j                  | _        d S d S d S )Nz(context menu callback implies a type of z but z was passed.r2  r3  r4  Fr5  r6  r1  )r   r*   r   r   rn   r7  r:  r   r1   r   r   _param_name_annotationr!  r<  r@  r   r;  rU   r%  rN   rQ   rT   r?  r(  )r   rn   r   r   r%  r&  rQ   rT   r'  r(  rB  r   r   actual_types                 rj   r   zContextMenu.__init__  s    0:$
/K/K]d++RVX\Q]f3D99	28.6+Fx+P+P(
K7??D$lllZ^lllmmm$(	 %%-%8#?"%h0Y[_``DO04:ADd;
 ;
  	 '2WY^ _ _=M >
QX94R
 R
 @P @
SZCTT
 T
 $+85VXZ#[#[&,l 	: ($.ty$9$9!!!	: 	:((rl   rb   c                    | j         S )z]:ref:`coroutine <coroutine>`: The coroutine that is executed when the context menu is called.rJ  r  s    rj   r   zContextMenu.callback  rK  rl   r   c                    | j         S )z7:class:`str`: Returns the fully qualified command name.r   r  s    rj   r  zContextMenu.qualified_name   s     yrl   rU  rV  rW  r)   r   c                   K   |                      |          }t          t          j        |           }| j        r?i }t
          D ]0}|                    | j        ||           d {V }|
|||j        <   1||d<   |S )NrY  r\  )rb  r(   r'   rc  r7  r   re  rf  )r   rU  rW  rh  contextr\  rB  rk  s           rj   r_  z"ContextMenu.get_translated_payload  s      ||D!!$.H.U\`aaa 	<13  C C$.$A$A$BSU[]d$e$eeeeeee*7B&v|4);D%&rl   c                    | j         | j        j        | j         |j                            | j                  |j                            | j                  | j        d n| j        j        | j        dS )N)rn   r   rq  rs  rt  rr  r%  )	rn   r   rf  rN   rQ   rw  rT   rU   r%  )r   rU  s     rj   rb  zContextMenu.to_dict  sn    IIO!%0-==d>STT!%!6!F!FtG\!]!]262J2R$$X\XpXvI
 
 	
rl   rz  r:   c                `   K   | j         }|sdS t          fd|D                        d {V S )NTc              3  .   K   | ]} |          V  d S r   r   r  s     rj   rk   z-ContextMenu._check_can_run.<locals>.<genexpr>"  r  rl   )r?  r4   )r   rz  r  s    ` rj   r  zContextMenu._check_can_run  sP      [
 	4BBBBzBBBBBBBBBBBBrl   c                    | j         d uS r   )r;  r  s    rj   r  z#ContextMenu._has_any_error_handlers$  s    }D((rl   r   r   c                  K   	 |                      |           d {V st          d| j        d          |                     ||           d {V  d S # t          $ r  t
          $ r}t          | |          |d }~ww xY w)Nz%The check functions for context menu r  )r  r#   rn   r:  r"   r  r$   )r   rz  r   r  s       rj   _invokezContextMenu._invoke'  s      	5,,[99999999 b"#`49#`#`#`aaa..c22222222222 	 	 	 	5 	5 	5$T1--14	5s   AA A?)A::A?r  UnboundErrorc                Z    t          j        |          st          d          || _        |S r  r  r  s     rj   r{  zContextMenu.error2  r  rl   r^   r  r   c               :    | j                             |           dS r  r  r  s     rj   r  zContextMenu.add_checkL  r  rl   c               ^    	 | j                             |           dS # t          $ r Y dS w xY wr  r  r  s     rj   r  zContextMenu.remove_checkY  r  r  )rn   r)  r   r   r   r   r%  r  r&  r,  rQ   r-  rT   r.  r'  r  r(  r/  )rb   r   r  r  r  r  r  )rz  r:   r   r   )r  r  rb   r  r  )r   r!  r   r"  r1   r   r#  r   r  r_  rb  r  r  r  r{  r  r  r   rl   rj   rC   rC     s;       E EX  ')-8<:>$(!(0: 0: 0: 0: 0: 0:d    X    X   	
 	
 	
 	
C C C C) ) ) )	5 	5 	5 	5   4! ! ! !     rl   c                     e Zd ZU dZg Zded<   dZded<   eZded<   eZ	ded	<   d
Z
ded<   d
Zded<   dZded<   eZded<   eZded<   eZded<   eZded<   dZded<   d
Zded<   eeededd\d"Zeed
d
eeeed#eed$d]d.Zd^d/Zd_d2Zed#d3d`d9Zdad?Zdbd@ZedcdA            ZedddB            ZdedDZedfdF            ZdgdHZe dhdM            Z!didPZ"djdQZ#ddRdkdVZ$dedWZ%dedXZ&eedd#edYdld[Z'd
S )mrD   a  A class that implements an application command group.

    These are usually inherited rather than created manually.

    Decorators such as :func:`guild_only`, :func:`guilds`, and :func:`default_permissions`
    will apply to the group if used on top of a subclass. For example:

    .. code-block:: python3

        from discord import app_commands

        @app_commands.guild_only()
        class MyGroup(app_commands.Group):
            pass

    .. versionadded:: 2.0

    Parameters
    -----------
    name: Union[:class:`str`, :class:`locale_str`]
        The name of the group. If not given, it defaults to a lower-case
        kebab-case version of the class name.
    description: Union[:class:`str`, :class:`locale_str`]
        The description of the group. This shows up in the UI to describe
        the group. If not given, it defaults to the docstring of the
        class shortened to 100 characters.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    default_permissions: Optional[:class:`~discord.Permissions`]
        The default permissions that can execute this group on Discord. Note
        that server administrators can override this value in the client.
        Setting an empty permissions field will disallow anyone except server
        administrators from using the command in a guild.

        Due to a Discord limitation, this does not work on subcommands.
    guild_only: :class:`bool`
        Whether the group should only be usable in guild contexts.
        Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.
        Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent application command. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.

    Attributes
    ------------
    name: :class:`str`
        The name of the group.
    description: :class:`str`
        The description of the group. This shows up in the UI to describe
        the group.
    default_permissions: Optional[:class:`~discord.Permissions`]
        The default permissions that can execute this group on Discord. Note
        that server administrators can override this value in the client.
        Setting an empty permissions field will disallow anyone except server
        administrators from using the command in a guild.

        Due to a Discord limitation, this does not work on subcommands.
    guild_only: :class:`bool`
        Whether the group should only be usable in guild contexts.

        Due to a Discord limitation, this does not work on subcommands.
    allowed_contexts: Optional[:class:`~discord.app_commands.AppCommandContext`]
        The contexts that this group is allowed to be used in. Overrides
        guild_only if set.

        .. versionadded:: 2.4
    allowed_installs: Optional[:class:`~discord.app_commands.AppInstallationType`]
        The installation contexts that the command is allowed to be installed
        on.

        .. versionadded:: 2.4
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels.

        Due to a Discord limitation, this does not work on subcommands.
    parent: Optional[:class:`Group`]
        The parent group. ``None`` if there isn't one.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    z4ClassVar[List[Union[Command[Any, ..., Any], Group]]]'__discord_app_commands_group_children__Fr  *__discord_app_commands_skip_init_binding__r   #__discord_app_commands_group_name__*__discord_app_commands_group_description__Nr
  *__discord_app_commands_group_locale_name__1__discord_app_commands_group_locale_description__#__discord_app_commands_group_nsfw__r4  r-  r5  r.  r6  Optional[Permissions]r3  #__discord_app_commands_has_module__zMOptional[Callable[[Interaction, AppCommandError], Coroutine[Any, Any, None]]]r}  )rn   ro   rN   r%  rU   rn   r)  ro   rN   r%  rU   rb   r   c               |   | j         sd | j                                        D             }|| _         t                      }|D ]=}|j        |v rt          d|j        d          |                    |j                   >t          |          dk    rt          d          |t          u r't          t          | j                            | _        nJt          |t                    rt          |          | _        n t          |j                  | _        || _        |t          u r)| j        d| _        nJt'          | j                  | _        n0t          |t                    r|| _        n|j        | _        || _        |t          ur|| _        |t          ur|| _        | j        t          k    rd| _        || _        d S )Nc                X    g | ]'}t          |t          t          f          r	|j        %|(S r   )r   rD   rB   r   )rh   members     rj   r`  z+Group.__init_subclass__.<locals>.<listcomp>  sD     D D D!jRWY`Qa>b>bDgmgtg|g|g|g|rl   zCommand z is a duplicate   z(groups cannot have more than 25 commandsr   T)r  r  r   setrn   r   addr   r1   r   r6   r   r  r   r   r   r  r"  r  r5   r  r4  r3  r!  r  r  )	clsrn   ro   rN   r%  rU   childrenfoundchilds	            rj   __init_subclass__zGroup.__init_subclass__  s    : 	LD D%(\%8%8%:%:D D DH ;CC7EEE! & &:&&#$Luz$L$L$LMMM		%*%%%%8}}r!! JKKK7??6CNSVS_D`D`6a6aC33c"" 	B6CD6I6IC336CDL6Q6QC3=AC:'!!{"AF>>AI#+AVAV>>S)) 	P=HC::=H=PC:DOCAW$$6@C3g--?RC<>X%%6:C326///rl   T)rn   ro   r   r&  rN   rQ   rT   r%  r'  rU   r(  r   r+  r&  r,  rQ   rT   r'  r(  r/  c                  | j         }|t          u r|j        |j        }}n=t	          |t
                    rt          |          d }}nt          |j                  |}}|| _        || _	        |t          u r|j
        |j        }}n#t	          |t
                    r|d }}n	|j        |}}|| _        || _        d | _        d | _        || _        | j        t#          |dd           | _        |
t          u r|j        t          u rd }
n|j        }
|
| _        |t          u r|j        t          u rd}n|j        }|| _        |t          u r|j        t          u rd }n|j        }|| _        |t          u r|j        t          u rd }n|j        }|| _        |t          u r|j        }|| _        | j        st9          d          | j        st9          d          || _        |  |j        r|j        | _         nN	 tC          j"                    j#        j$        d         | _         n$# tJ          tL          tN          f$ r
 d | _         Y nw xY wi | _(        |pi | _)        i }| j*        D ]W}|j+        s|,                    | | |d          n|}|| j(        |j        <   |j        r|j+        st[          | |j        |           X|+|j        t]          d          |/                    |            |	r| 0                                 d S d S )Nr2  Fzgroups must have a descriptionzgroups must have a namer   )r   r   rM  rN  z+groups can only be nested at most one level)1	__class__r1   r  r  r   r   r   r   rn   r7  r  r  ro   r8  r9  
_owner_clsr@  r   r3  rU   r4  rN   r5  rQ   r6  rT   r  r%  r   r   r  r!  r<  rt   currentframef_back	f_globalsr   
IndexErrorr  	_childrenr(  r  r  rT  rS  r   add_commandrA  )r   rn   ro   r   r&  rN   rQ   rT   r%  r'  rU   r(  r  rB  rM  r   r   s                    rj   r   zGroup.__init__  sr    n7??BCDr&DDc"" 	=(..&DD(66&D	28'!!>E  KK S)) 	C"-tKK"-"5{K +9? $(
/3/8?"%c+TVZ[[DO'))?7JJ&*##&)&V#:M   6'AA"

 D
 *w&&4??#'  #&#H =Mw&&>'II#'  #&#R ?O7??:D	 	><===y 	75666'-"2 	#.DKK# &244;EjQ"J9 # # #"# <>&,l')A 
	0 
	0E E  dX^c ddd  )-DN49%z 0#"P 0dj$///}( !NOOOt$$$ 	.++-----	. 	.s   '(H H10H1c                    | j         t          | j                  | _         | j        t          | j                  | _        d S d S r   )r7  r*   rn   r8  ro   r  s    rj   rA  z Group._convert_to_locale_strings  sG    $ *49 5 5D#+'1$2B'C'CD$$$ ,+rl   rD  rE  c                :    || _         |j        | _        || _        d S r   )r9  r!  r<  r  rG  s      rj   rH  zGroup.__set_name__  s    
&rl   rL  r   r[   rM  MutableMapping[Group, Group]rN  c                  |t           u ri n|}t          |           }||_        i |_        ||| <   | j                                        D ]}|                    |||          }||_        ||j        |j        <   t          |t                    rR|j	        rK|rI|j
        |j        u rt          ||j	        |           s|j        |j
        u rt          ||j	        |           |j	        r|rt          |p||j	        |           |S )N)r   r   rM  )r1   rQ  r   r	  r   rT  rn   r   rD   r9  r  r  rS  )r   r   r   rM  rN  r   r   
child_copys           rj   rT  zGroup._copy_with  s/    "W,,22(D!!^**,, 		@ 		@E))wQY)ZZJ $J.8DN:?+*e,, @1A @n @$
(===GZ%5zBBBB*dn<<D*"2J???: 	9. 	9F%gtz4888rl   rU  rV  rW  r)   r   c                  K   |                                }i }i }t          t          j        |           }t          t          j        |           }t
          D ]l}| j        r.                    | j        ||           d {V }	|	
|	||j        <   | j	        r.                    | j	        ||           d {V }	|	
|	||j        <   m||d<   ||d<   fd| j
                                        D              d {V |d<   |S )NrY  r\  r]  c                L   K   g | ]}|                                d {V S r   )r_  )rh   r   rW  rU  s     rj   r`  z0Group.get_translated_payload.<locals>.<listcomp>  s@      uuuTY!=!=dJ!O!OOOOOOOuuurl   ra  )rb  r(   r'   
group_namegroup_descriptionr   r7  re  rf  r8  r	  r   rg  s
    ``       rj   r_  zGroup.get_translated_payload  s_     ||D!!-/46! *3M3X_cddd0:T:fmqrrr 		J 		JF  C$.$A$A$BSU[]i$j$jjjjjjj*7B&v|4' J$.$A$A$BZ\bdw$x$xxxxxxx*>I-fl;%7!",E()uuuuu]a]k]r]r]t]tuuuuuuuuuYrl   c                   | j         dnt          j        j        }| j        | j        |fd| j                                        D             d}| j         q| j        |d<   | j	         |d<   | j
        d n| j
        j        |d<   j                            | j                  |d<   j                            | j                  |d<   |S )	Nr   c                :    g | ]}|                               S r   rn  )rh   r   rU  s     rj   r`  z!Group.to_dict.<locals>.<listcomp>  s%    QQQd++QQQrl   rp  r%  rq  rr  rs  rt  )r   r   subcommand_grouprf  rn   ro   r	  r   r%  rN   rU   rQ   rw  rT   rx  s    `  rj   rb  zGroup.to_dict  s      ;.aa4H4Y4_I+QQQQ9N9N9P9PQQQ	 
  
 ;9DL(,$7D!9=9Q9Y_c_w_}D-.#4DDTEZ[[D(,(=(M(MdNc(d(dD$%rl   c                    | j         S )z3Optional[:class:`Group`]: The parent of this group.r  r  s    rj   r  zGroup.root_parent  s     {rl   c                J    | j         | j        S | j         j         d| j         S )z:class:`str`: Returns the fully qualified group name.

        The qualified name includes the parent name as well. For example,
        in a group like ``/foo bar`` the qualified name is ``foo bar``.
        Nr  )r   rn   r  s    rj   r  zGroup.qualified_name  s/     ;9+"00TY000rl   .Optional[Union[Command[Any, ..., Any], Group]]c                6    | j                             |          S r   r	  rR  r  s     rj   r  zGroup._get_internal_command  s    ~!!$'''rl   *List[Union[Command[Any, ..., Any], Group]]c                N    t          | j                                                  S )zUList[Union[:class:`Command`, :class:`Group`]]: The commands that this group contains.)r   r	  r   r  s    rj   r@   zGroup.commands  s      DN))++,,,rl   ;Generator[Union[Command[Any, ..., Any], Group], None, None]c              #     K   | j                                         D ]5}|V  t          |t                    r|                                E d{V  6dS )zAn iterator that recursively walks through all commands that this group contains.

        Yields
        ---------
        Union[:class:`Command`, :class:`Group`]
            The commands in this group.
        N)r	  r   r   rD   walk_commands)r   rG   s     rj   r   zGroup.walk_commands  so       ~,,.. 	3 	3GMMM'5)) 3"00222222222	3 	3rl   rz  Interaction[ClientT]r{  r"   c               
   K   dS )a  |coro|

        A callback that is called when a child's command raises an :exc:`AppCommandError`.

        To get the command that failed, :attr:`discord.Interaction.command` should be used.

        The default implementation does nothing.

        Parameters
        -----------
        interaction: :class:`~discord.Interaction`
            The interaction that is being handled.
        error: :exc:`AppCommandError`
            The exception that was raised.
        Nr   )r   rz  r{  s      rj   r;  zGroup.on_error  s      $ 	rl   r  	ErrorFuncc                    t          j        |          st          d          t          j        |          j        }t          |          dk    rt          d          || _        |S )aa  A decorator that registers a coroutine as a local error handler.

        The local error handler is called whenever an exception is raised in a child command.
        The error handler must take 2 parameters, the interaction and the error.

        The error passed will be derived from :exc:`AppCommandError`.

        Parameters
        -----------
        coro: :ref:`coroutine <coroutine>`
            The coroutine to register as the local error handler.

        Raises
        -------
        TypeError
            The coroutine passed is not actually a coroutine, or is an invalid coroutine.
        r  r   z)The error handler must have 2 parameters.)rt   r   r   r   r   r   r;  )r   r  r`   s      rj   r{  zGroup.error   sf    & *400 	FDEEE"4((3v;;!GHHHrl   c               
   K   dS )ab  |coro|

        A callback that is called when an interaction happens within the group
        that checks whether a command inside the group should be executed.

        This is useful to override if, for example, you want to ensure that the
        interaction author is a given user.

        The default implementation of this returns ``True``.

        .. note::

            If an exception occurs within the body then the check
            is considered a failure and error handlers such as
            :meth:`on_error` is called. See :exc:`AppCommandError`
            for more information.

        Parameters
        -----------
        interaction: :class:`~discord.Interaction`
            The interaction that occurred.

        Returns
        ---------
        :class:`bool`
            Whether the view children's callbacks should be called.
        Tr   )r   rz  s     rj   r  zGroup.interaction_check=  s      : trl   )overriderG   $Union[Command[Any, ..., Any], Group]r&  c                 t          |t          t          f          st          d|j        j                   t          |t                    r| j        t          |j        d          |s$|j        | j	        v rt          |j        d          || j	        |j        <   | |_        t          | j	                  dk    rt          d          dS )a*  Adds a command or group to this group's internal list of commands.

        Parameters
        -----------
        command: Union[:class:`Command`, :class:`Group`]
            The command or group to add.
        override: :class:`bool`
            Whether to override a pre-existing command or group with the same name.
            If ``False`` then an exception is raised.

        Raises
        -------
        CommandAlreadyRegistered
            The command or group is already registered. Note that the :attr:`CommandAlreadyRegistered.guild_id`
            attribute will always be ``None`` in this case.
        ValueError
            There are too many commands already registered or the group is too
            deeply nested.
        TypeError
            The wrong command type was passed.
        zexpected Command or Group not Nz; is too nested, groups can only be nested at most one level)guild_idr  z)maximum number of child commands exceeded)r   rB   rD   r   r  r   r   r   rn   r	  r&   r   )r   rG   r&  s      rj   r
  zGroup.add_command\  s    . 'GU#344 	[YW=N=WYYZZZgu%% 	m$+*A kkklll 	HGLDN::*7<$GGGG'.w|$t~##HIII $#rl   c               <    | j                             |d           dS )a  Removes a command or group from the internal list of commands.

        Parameters
        -----------
        name: :class:`str`
            The name of the command or group to remove.

        Returns
        --------
        Optional[Union[:class:`~discord.app_commands.Command`, :class:`~discord.app_commands.Group`]]
            The command that was removed. If nothing was removed
            then ``None`` is returned instead.
        N)r	  r   r  s     rj   remove_commandzGroup.remove_command  s"     	4&&&&&rl   c               6    | j                             |          S )a  Retrieves a command or group from its name.

        Parameters
        -----------
        name: :class:`str`
            The name of the command or group to retrieve.

        Returns
        --------
        Optional[Union[:class:`~discord.app_commands.Command`, :class:`~discord.app_commands.Group`]]
            The command or group that was retrieved. If nothing was found
            then ``None`` is returned instead.
        r  r  s     rj   get_commandzGroup.get_command  s     ~!!$'''rl   rn   ro   r%  r'  r(  @Callable[[CommandCallback[GroupT, P, T]], Command[GroupT, P, T]]c               (     d fd}|S )aM  A decorator that creates an application command from a regular function under this group.

        Parameters
        ------------
        name: Union[:class:`str`, :class:`locale_str`]
            The name of the application command. If not given, it defaults to a lower-case
            version of the callback name.
        description: Union[:class:`str`, :class:`locale_str`]
            The description of the application command. This shows up in the UI to describe
            the application command. If not given, it defaults to the first line of the docstring
            of the callback shortened to 100 characters.
        nsfw: :class:`bool`
            Whether the command is NSFW and should only work in NSFW channels. Defaults to ``False``.
        auto_locale_strings: :class:`bool`
            If this is set to ``True``, then all translatable strings will implicitly
            be wrapped into :class:`locale_str` rather than :class:`str`. This could
            avoid some repetition and be more ergonomic for certain defaults such
            as default command names, command descriptions, and parameter names.
            Defaults to ``True``.
        extras: :class:`dict`
            A dictionary that can be used to store extraneous data.
            The library will not touch any values or keys within this dictionary.
        r^   r*  rb   Command[GroupT, P, T]c           	        t          j        |           st          d          t          u r| j        d}nt          | j                  }n}t          t          urn| j        ||           }                    |           |S )N-command function must be a coroutine functionr   )rn   ro   r   r%  r   r'  r(  )	rt   r   r   r1   r"  r5   rB   r   r
  )	r^   descrG   r'  ro   r(  rn   r%  r   s	      rj   r  z Group.command.<locals>.decorator  s    .t44 Q OPPPg%%<' DD#DL11DD"!00TTdm $7  G W%%%Nrl   r^   r*  rb   r1  r   )r   rn   ro   r%  r'  r(  r  s   `````` rj   rG   zGroup.command  sH    B	 	 	 	 	 	 	 	 	 	 	0 rl   )rn   r)  ro   r)  rN   r  r%  r  rU   r  rb   r   )rn   r)  ro   r)  r   r+  r&  r,  rN   r  rQ   r-  rT   r.  r%  r  r'  r  rU   r  r(  r/  r  r  )
r   r+  r   r[   rM  r  rN  r  rb   rD   r  r  r  r  )rn   r   rb   r  )rb   r  )rb   r  )rz  r!  r{  r"   rb   r   )r  r#  rb   r#  )rz  r!  rb   r  )rG   r'  r&  r  rb   r   rn   r)  ro   r)  r%  r  r'  r  r(  r/  rb   r/  )(r   r!  r   r"  r  __annotations__r  r1   r  r  r  r  r  r4  r5  r6  r3  r  r}  r  r   rA  rH  rT  r_  rb  r#  r  r  r  r@   r   r   r;  r{  r  r
  r+  r-  rG   r   rl   rj   rD   rD   k  sb        \ \| eg+ffff7<.<<<</6'66666=.====GK.KKKKNR5RRRR05'555507'7777EL%LLLLQX/XXXXJQ0QQQQ05'5555 +     (/.5"5<47 47 47 47 47 47r (/.5"&)-"8?:A$(5<!(z. z. z. z. z. z.xD D D D        29#     @   0   (    X 	1 	1 	1 X	1( ( ( ( - - - X-3 3 3 3    &   :   > af (J (J (J (J (J (JT' ' ' '"( ( ( (& (/.5$(!(9 9 9 9 9 9 9 9rl   rD   FTr.  r)  ro   r%  r  r'  r(  r/  r/  c                $     d fd}|S )a  Creates an application command from a regular function.

    Parameters
    ------------
    name: :class:`str`
        The name of the application command. If not given, it defaults to a lower-case
        version of the callback name.
    description: :class:`str`
        The description of the application command. This shows up in the UI to describe
        the application command. If not given, it defaults to the first line of the docstring
        of the callback shortened to 100 characters.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels. Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    r^   r*  rb   r1  c           	         t          j        |           st          d          t          u r| j        d}nt          | j                  }n}t          t          urn| j        || d           S )Nr3  r   )rn   ro   r   r   r%  r'  r(  )rt   r   r   r1   r"  r5   rB   r   )r^   r4  r'  ro   r(  rn   r%  s     rj   r  zcommand.<locals>.decorator  s    *400 	MKLLL'!!|#--DW,,$- 3
 
 
 	
rl   r5  r   )rn   ro   r%  r'  r(  r  s   ````` rj   rG   rG     sB    D
 
 
 
 
 
 
 
 
 
, rl   )rn   r%  r'  r(  ,Callable[[ContextMenuCallback], ContextMenu]c                      d fd}|S )az  Creates an application command context menu from a regular function.

    This function must have a signature of :class:`~discord.Interaction` as its first parameter
    and taking either a :class:`~discord.Member`, :class:`~discord.User`, or :class:`~discord.Message`,
    or a :obj:`typing.Union` of ``Member`` and ``User`` as its second parameter.

    Examples
    ---------

    .. code-block:: python3

        @app_commands.context_menu()
        async def react(interaction: discord.Interaction, message: discord.Message):
            await interaction.response.send_message('Very cool message!', ephemeral=True)

        @app_commands.context_menu()
        async def ban(interaction: discord.Interaction, user: discord.Member):
            await interaction.response.send_message(f'Should I actually ban {user}...', ephemeral=True)

    Parameters
    ------------
    name: Union[:class:`str`, :class:`locale_str`]
        The name of the context menu command. If not given, it defaults to a title-case
        version of the callback name. Note that unlike regular slash commands this can
        have spaces and upper case characters in the name.
    nsfw: :class:`bool`
        Whether the command is NSFW and should only work in NSFW channels. Defaults to ``False``.

        Due to a Discord limitation, this does not work on subcommands.
    auto_locale_strings: :class:`bool`
        If this is set to ``True``, then all translatable strings will implicitly
        be wrapped into :class:`locale_str` rather than :class:`str`. This could
        avoid some repetition and be more ergonomic for certain defaults such
        as default command names, command descriptions, and parameter names.
        Defaults to ``True``.
    extras: :class:`dict`
        A dictionary that can be used to store extraneous data.
        The library will not touch any values or keys within this dictionary.
    r^   r   rb   rC   c                    t          j        |           st          d          t          u r| j                                        n}t          ||           S )Nz2context menu function must be a coroutine function)rn   r%  r   r'  r(  )rt   r   r   r1   r   titlerC   )r^   actual_namer'  r(  rn   r%  s     rj   r  zcontext_menu.<locals>.decoratorM  sl    *400 	RPQQQ/3wdm))+++D 3
 
 
 	
rl   )r^   r   rb   rC   r   )rn   r%  r'  r(  r  s   ```` rj   rF   rF     s<    ^
 
 
 
 
 
 
 
 
 rl   r   Callable[[T], T]c                      d fd}|S )ac  Describes the given parameters by their name using the key of the keyword argument
    as the name.

    Example:

    .. code-block:: python3

        @app_commands.command(description='Bans a member')
        @app_commands.describe(member='the member to ban')
        async def ban(interaction: discord.Interaction, member: discord.Member):
            await interaction.response.send_message(f'Banned {member}')

    Alternatively, you can describe parameters using Google, Sphinx, or Numpy style docstrings.

    Example:

    .. code-block:: python3

        @app_commands.command()
        async def ban(interaction: discord.Interaction, member: discord.Member):
            """Bans a member

            Parameters
            -----------
            member: discord.Member
                the member to ban
            """
            await interaction.response.send_message(f'Banned {member}')

    Parameters
    -----------
    \*\*parameters: Union[:class:`str`, :class:`locale_str`]
        The description of the parameters.

    Raises
    --------
    TypeError
        The parameter name is not found.
    innerrW   rb   c                    t          | d|           p| }t          |t                    rt          |j                   n3	 | j                                       n# t          $ r
 | _        Y nw xY w| S N__discord_app_commands_unwrap__)r   r   rB   r   r>  r   r   r   rA  	unwrappedr   s     rj   r  zdescribe.<locals>.decorator  s    E#DeLLUPU	i)) 	N"9#4jAAAAN@GG
SSSS! N N NCM@@@N    A A0/A0rA  rW   rb   rW   r   r   r  s   ` rj   rH   rH   ]  s*    R
 
 
 
 
 
 rl   c                      d fd}|S )aw  Renames the given parameters by their name using the key of the keyword argument
    as the name.

    This renames the parameter within the Discord UI. When referring to the parameter in other
    decorators, the parameter name used in the function is used instead of the renamed one.

    Example:

    .. code-block:: python3

        @app_commands.command()
        @app_commands.rename(the_member_to_ban='member')
        async def ban(interaction: discord.Interaction, the_member_to_ban: discord.Member):
            await interaction.response.send_message(f'Banned {the_member_to_ban}')

    Parameters
    -----------
    \*\*parameters: Union[:class:`str`, :class:`locale_str`]
        The name of the parameters.

    Raises
    --------
    ValueError
        The parameter name is already used by another parameter.
    TypeError
        The parameter name is not found.
    rA  rW   rb   c                    t          | d|           p| }t          |t                    rt          |j                   n3	 | j                                       n# t          $ r
 | _        Y nw xY w| S rC  )r   r   rB   r   r>  r   r   r   rE  s     rj   r  zrename.<locals>.decorator  s    E#DeLLUPU	i)) 	Ii/<<<<I;BB:NNNN! I I I>H;;;I rG  rH  r   rI  s   ` rj   rJ   rJ     s)    :
 
 
 
 
 
 rl   List[Choice[ChoiceT]]c                      d fd}|S )a  Instructs the given parameters by their name to use the given choices for their choices.

    Example:

    .. code-block:: python3

        @app_commands.command()
        @app_commands.describe(fruits='fruits to choose from')
        @app_commands.choices(fruits=[
            Choice(name='apple', value=1),
            Choice(name='banana', value=2),
            Choice(name='cherry', value=3),
        ])
        async def fruit(interaction: discord.Interaction, fruits: Choice[int]):
            await interaction.response.send_message(f'Your favourite fruit is {fruits.name}.')

    .. note::

        This is not the only way to provide choices to a command. There are two more ergonomic ways
        of doing this. The first one is to use a :obj:`typing.Literal` annotation:

        .. code-block:: python3

            @app_commands.command()
            @app_commands.describe(fruits='fruits to choose from')
            async def fruit(interaction: discord.Interaction, fruits: Literal['apple', 'banana', 'cherry']):
                await interaction.response.send_message(f'Your favourite fruit is {fruits}.')

        The second way is to use an :class:`enum.Enum`:

        .. code-block:: python3

            class Fruits(enum.Enum):
                apple = 1
                banana = 2
                cherry = 3

            @app_commands.command()
            @app_commands.describe(fruits='fruits to choose from')
            async def fruit(interaction: discord.Interaction, fruits: Fruits):
                await interaction.response.send_message(f'Your favourite fruit is {fruits}.')


    Parameters
    -----------
    \*\*parameters
        The choices of the parameters.

    Raises
    --------
    TypeError
        The parameter name is not found or the parameter type was incorrect.
    rA  rW   rb   c                    t          | d|           p| }t          |t                    rt          |j                   n3	 | j                                       n# t          $ r
 | _        Y nw xY w| S rC  )r   r   rB   r   r>  r   r   r   rE  s     rj   r  zchoices.<locals>.decorator  s    E#DeLLUPU	i)) 	Ji/<<<<J<CCJOOOO! J J J?I<<<J rG  rH  r   rI  s   ` rj   rK   rK     s*    n
 
 
 
 
 
 rl   c                      d fd}|S )a>  Associates the given parameters with the given autocomplete callback.

    Autocomplete is only supported on types that have :class:`str`, :class:`int`, or :class:`float`
    values.

    :func:`Checks <check>` are supported, however they must be attached to the autocomplete
    callback in order to work. Checks attached to the command are ignored when invoking the autocomplete
    callback.

    For more information, see the :meth:`Command.autocomplete` documentation.

    .. warning::
        The choices returned from this coroutine are suggestions. The user may ignore them and input their own value.

    Example:

    .. code-block:: python3

            async def fruit_autocomplete(
                interaction: discord.Interaction,
                current: str,
            ) -> List[app_commands.Choice[str]]:
                fruits = ['Banana', 'Pineapple', 'Apple', 'Watermelon', 'Melon', 'Cherry']
                return [
                    app_commands.Choice(name=fruit, value=fruit)
                    for fruit in fruits if current.lower() in fruit.lower()
                ]

            @app_commands.command()
            @app_commands.autocomplete(fruit=fruit_autocomplete)
            async def fruits(interaction: discord.Interaction, fruit: str):
                await interaction.response.send_message(f'Your favourite fruit seems to be {fruit}')

    Parameters
    -----------
    \*\*parameters
        The parameters to mark as autocomplete.

    Raises
    --------
    TypeError
        The parameter name is not found or the parameter type was incorrect.
    rA  rW   rb   c                    t          | d|           p| }t          |t                    rt          |j                   n3	 | j                                       n# t          $ r
 | _        Y nw xY w| S rC  )r   r   rB   r   r>  r   r   r   rE  s     rj   r  zautocomplete.<locals>.decorator4	  s    E#DeLLUPU	i)) 	O"9#4jAAAAOAHHTTTT! O O ODNAAAO rG  rH  r   rI  s   ` rj   rL   rL   	  s*    Z
 
 
 
 
 
 rl   r&  Union[Snowflake, int]c                 ,    d | D             dfd}|S )a  Associates the given guilds with the command.

    When the command instance is added to a :class:`CommandTree`, the guilds that are
    specified by this decorator become the default guilds that it's added to rather
    than being a global command.

    If no arguments are given, then the command will not be synced anywhere. This may
    be modified later using the :meth:`CommandTree.add_command` method.

    .. note::

        Due to an implementation quirk and Python limitation, if this is used in conjunction
        with the :meth:`CommandTree.command` or :meth:`CommandTree.context_menu` decorator
        then this must go below that decorator.

    .. note ::

        Due to a Discord limitation, this decorator cannot be used in conjunction with
        contexts (e.g. :func:`.app_commands.allowed_contexts`) or installation types
        (e.g. :func:`.app_commands.allowed_installs`).

    Example:

    .. code-block:: python3

            MY_GUILD_ID = discord.Object(...)  # Guild ID here

            @app_commands.command()
            @app_commands.guilds(MY_GUILD_ID)
            async def bonk(interaction: discord.Interaction):
                await interaction.response.send_message('Bonk', ephemeral=True)

    Parameters
    -----------
    \*guild_ids: Union[:class:`int`, :class:`~discord.abc.Snowflake`]
        The guilds to associate this command with. The command tree will
        use this as the default when added rather than adding it as a global
        command.
    c                J    g | ] }t          |t                    r|n|j        !S r   )r   intid)rh   gs     rj   r`  zguilds.<locals>.<listcomp>l	  s-    PPP
1c 2 2<11PPPrl   rA  rW   rb   c                    t          | d|           p| }t          |t          t          f          r|_        n:t          |t
                    r|j        t          d          |_        n| _        | S )NrD  z8child commands of a group cannot have default guilds set)	r   r   rD   rC   r@  rB   r   r   r2  )rA  rF  defaultss     rj   r  zguilds.<locals>.decoratorn	  s    E#DeLLUPU	i%!566 		E#+I  	7++ 	E+ ![\\\#+I   =EE9rl   rH  r   )r&  r  rX  s     @rj   rM   rM   C	  s@    R QPiPPPH      rl   	predicater  c                     d fd}|S )a  A decorator that adds a check to an application command.

    These checks should be predicates that take in a single parameter taking
    a :class:`~discord.Interaction`. If the check returns a ``False``\-like value then
    during invocation a :exc:`CheckFailure` exception is raised and sent to
    the appropriate error handlers.

    These checks can be either a coroutine or not.

    Examples
    ---------

    Creating a basic check to see if the command invoker is you.

    .. code-block:: python3

        def check_if_it_is_me(interaction: discord.Interaction) -> bool:
            return interaction.user.id == 85309593344815104

        @tree.command()
        @app_commands.check(check_if_it_is_me)
        async def only_for_me(interaction: discord.Interaction):
            await interaction.response.send_message('I know you!', ephemeral=True)

    Transforming common checks into its own decorator:

    .. code-block:: python3

        def is_me():
            def predicate(interaction: discord.Interaction) -> bool:
                return interaction.user.id == 85309593344815104
            return app_commands.check(predicate)

        @tree.command()
        @is_me()
        async def only_me(interaction: discord.Interaction):
            await interaction.response.send_message('Only you!')

    Parameters
    -----------
    predicate: Callable[[:class:`~discord.Interaction`], :class:`bool`]
        The predicate to check if the command should be invoked.
    r^   CheckInputParameterrb   c                    t          | d|           p| }t          |t          t          f          r|j                                       n1t          | d          sg | _        | j                                       | S )NrD  r1  )r   r   rB   rC   r?  r   r   r1  )r^   rF  rY  s     rj   r  zcheck.<locals>.decorator	  s    D"CTJJRd	i';!788 	C##I....4!BCC :794077	BBBrl   )r^   r[  rb   r[  r   )rY  r  s   ` rj   rI   rI   	  s*    Z
 
 
 
 
 
 rl   c                    d S r   r   r   s    rj   rN   rN   	  s    69crl   c                    d S r   r   r   s    rj   rN   rN   	  s    !crl   Optional[T]Union[T, Callable[[T], T]]c                (    dd}| |S  ||           S )a  A decorator that indicates this command can only be used in a guild context.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.
    Therefore, there is no error handler called when a command is used within a private message.

    This decorator can be called with or without parentheses.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.guild_only()
        async def my_guild_only_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am only available in guilds!')
    r  rW   rb   c                    t          | d|           p| }t          |t          t          t          f          r$d|_        |j        pt                      }||_        n-d| _        t          | dd           pt                      }|| _	        d|_
        | S )NrD  Tr5  )r   r   rB   rD   rC   rN   rQ   r   r4  r5  guildr  rF  rQ   s      rj   rA  zguild_only.<locals>.inner	  s    A@!DDI	i'5+!>?? 	C#'I (9P=N=P=P)9I&&48A1&q*MtTTkXiXkXk2BA/!%rl   Nr  rW   rb   rW   r   r^   rA  s     rj   rN   rN   	  s0    *   " |uT{{rl   c                    d S r   r   r   s    rj   rP   rP   	  s    @Crl   c                    d S r   r   r   s    rj   rP   rP   	  s    (+rl   c                (    dd}| |S  ||           S )a  A decorator that indicates this command can only be used in the context of DMs and group DMs.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.
    Therefore, there is no error handler called when a command is used within a guild.

    This decorator can be called with or without parentheses.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. versionadded:: 2.4

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.private_channel_only()
        async def my_private_channel_only_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am only available in DMs and GDMs!')
    r  rW   rb   c                   t          | d|           p| }t          |t          t          t          f          r$d|_        |j        pt                      }||_        n&t          | dd           pt                      }|| _        d|_	        | S NrD  Fr5  T)
r   r   rB   rD   rC   rN   rQ   r   r5  private_channelrd  s      rj   rA  z#private_channel_only.<locals>.inner
  s    A@!DDI	i'5+!>?? 	C#(I (9P=N=P=P)9I&&&q*MtTTkXiXkXk2BA/+/(rl   Nre  r   rf  s     rj   rP   rP   	  s0    .    |uT{{rl   c                    d S r   r   r   s    rj   rO   rO   &
  s    363rl   c                    d S r   r   r   s    rj   rO   rO   *
  s    3rl   c                (    dd}| |S  ||           S )a  A decorator that indicates this command can only be used in the context of bot DMs.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.
    Therefore, there is no error handler called when a command is used within a guild or group DM.

    This decorator can be called with or without parentheses.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.dm_only()
        async def my_dm_only_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am only available in DMs!')
    r  rW   rb   c                   t          | d|           p| }t          |t          t          t          f          r$d|_        |j        pt                      }||_        n&t          | dd           pt                      }|| _        d|_	        | S rk  )
r   r   rB   rD   rC   rN   rQ   r   r5  
dm_channelrd  s      rj   rA  zdm_only.<locals>.innerC
  s    A@!DDI	i'5+!>?? 	C#(I (9P=N=P=P)9I&&&q*MtTTkXiXkXk2BA/&*#rl   Nre  r   rf  s     rj   rO   rO   .
  s0    *    |uT{{rl   rM   dmsprivate_channelsc                     d fd}|S )a  A decorator that indicates this command can only be used in certain contexts.
    Valid contexts are guilds, DMs and private channels.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. versionadded:: 2.4

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.allowed_contexts(guilds=True, dms=False, private_channels=True)
        async def my_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am only available in guilds and private channels!')
    r  rW   rb   c                f   t          | d|           p| }t          |t          t          t          f          r$d|_        |j        pt                      }||_        n&t          | dd           pt                      }|| _        t          ur|_
        t          ur|_        t          ur|_        | S )NrD  Fr5  )r   r   rB   rD   rC   rN   rQ   r   r5  r1   rc  rq  rl  )r  rF  rQ   rr  rM   rs  s      rj   rA  zallowed_contexts.<locals>.innerm
  s    A@!DDI	i'5+!>?? 	C#(I (9P=N=P=P)9I&&&q*MtTTkXiXkXk2BA/  %+"g*-'7**/?,rl   re  r   )rM   rr  rs  rA  s   ``` rj   rQ   rQ   X
  s4    *       * Lrl   c                    d S r   r   r   s    rj   rR   rR   
  s    9<rl   c                    d S r   r   r   s    rj   rR   rR   
  s    !$rl   c                (    dd}| |S  ||           S )aZ  A decorator that indicates this command should be installed in guilds.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. versionadded:: 2.4

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.guild_install()
        async def my_guild_install_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am installed in guilds by default!')
    r  rW   rb   c                   t          | d|           p| }t          |t          t          t          f          r|j        pt                      }||_        n&t          | dd           pt                      }|| _        d|_        | S NrD  r6  T)	r   r   rB   rD   rC   rT   r   r6  rc  r  rF  rT   s      rj   rA  zguild_install.<locals>.inner
  s    A@!DDI	i'5+!>?? 	M(9R=P=R=R)9I&&&q*WY]^^wbubwbw<LA9!%rl   Nre  r   rf  s     rj   rR   rR   
  0    (    |uT{{rl   c                    d S r   r   r   s    rj   rS   rS   
  s    8;rl   c                    d S r   r   r   s    rj   rS   rS   
  s     #rl   c                (    dd}| |S  ||           S )aW  A decorator that indicates this command should be installed for users.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. versionadded:: 2.4

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.user_install()
        async def my_user_install_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am installed in users by default!')
    r  rW   rb   c                   t          | d|           p| }t          |t          t          t          f          r|j        pt                      }||_        n&t          | dd           pt                      }|| _        d|_        | S rz  )	r   r   rB   rD   rC   rT   r   r6  r   r{  s      rj   rA  zuser_install.<locals>.inner
  s    A@!DDI	i'5+!>?? 	M(9R=P=R=R)9I&&&q*WY]^^wbubwbw<LA9 $rl   Nre  r   rf  s     rj   rS   rS   
  r|  rl   usersc                     d fd}|S )a  A decorator that indicates this command should be installed in certain contexts.
    Valid contexts are guilds and users.

    This is **not** implemented as a :func:`check`, and is instead verified by Discord server side.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. versionadded:: 2.4

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.allowed_installs(guilds=False, users=True)
        async def my_command(interaction: discord.Interaction) -> None:
            await interaction.response.send_message('I am installed in users by default!')
    r  rW   rb   c                8   t          | d|           p| }t          |t          t          t          f          r|j        pt                      }||_        n&t          | dd           pt                      }|| _        t          ur|_	        t          ur|_
        | S )NrD  r6  )r   r   rB   rD   rC   rT   r   r6  r1   rc  r   )r  rF  rT   rM   r  s      rj   rA  zallowed_installs.<locals>.inner
  s    A@!DDI	i'5+!>?? 	M(9R=P=R=R)9I&&&q*WY]^^wbubwbw<LA9  %+"$)!rl   re  r   )rM   r  rA  s   `` rj   rT   rT   
  s.    0      " Lrl   	perms_objr  permsUnpack[_PermissionsKwargs]c               P    | | t          di |z  nt          di |dfd}|S )a  A decorator that sets the default permissions needed to execute this command.

    When this decorator is used, by default users must have these permissions to execute the command.
    However, an administrator can change the permissions needed to execute this command using the official
    client. Therefore, this only serves as a hint.

    Setting an empty permissions field, including via calling this with no arguments, will disallow anyone
    except server administrators from using the command in a guild.

    This is sent to Discord server side, and is not a :func:`check`. Therefore, error handlers are not called.

    Due to a Discord limitation, this decorator does nothing in subcommands and is ignored.

    .. warning::

        This serves as a *hint* and members are *not* required to have the permissions given to actually
        execute this command. If you want to ensure that members have the permissions needed, consider using
        :func:`~discord.app_commands.checks.has_permissions` instead.

    Parameters
    -----------
    \*\*perms: :class:`bool`
        Keyword arguments denoting the permissions to set as the default.
    perms_obj: :class:`~discord.Permissions`
        A permissions object as positional argument. This can be used in combination with ``**perms``.

        .. versionadded:: 2.5

    Examples
    ---------

    .. code-block:: python3

        @app_commands.command()
        @app_commands.default_permissions(manage_messages=True)
        async def test(interaction: discord.Interaction):
            await interaction.response.send_message('You may or may not have manage messages.')

    .. code-block:: python3

        ADMIN_PERMS = discord.Permissions(administrator=True)

        @app_commands.command()
        @app_commands.default_permissions(ADMIN_PERMS, manage_messages=True)
        async def test(interaction: discord.Interaction):
            await interaction.response.send_message('You may or may not have manage messages.')
    Nr^   rW   rb   c                    t          | d|           p| }t          |t          t          t          f          r|_        n| _        | S rC  )r   r   rB   rD   rC   rU   r3  )r^   rF  permissionss     rj   r  z&default_permissions.<locals>.decoratorI  sL    D"CTJJRd	i'5+!>?? 	L,7I))@KD=rl   r   r^   rW   rb   rW   r.   )r  r  r  r  s      @rj   rU   rU     s_    b +"6"6"6"66!**E**      rl   )r^   r_   r`   ra   rb   rc   )rn   r   rb   r   )r   r   rb   r   )r   r   r   r   rb   r   )r`   ra   r   r   rb   r   )r`   ra   r   r   rb   r   )r`   ra   r   r   rb   r   )r`   ra   rL   r   rb   r   )r^   r_   r   r   rb   ra   )r^   r   rb   r   )r^   rX   rb   rX   r6  )
rn   r)  r%  r  r'  r  r(  r/  rb   r:  )r   r)  rb   r?  )r   rL  rb   r?  )r   r   rb   r?  )r&  rQ  rb   r?  )rY  r  rb   r?  ).)r^   r   rb   r?  r  r   )r^   r_  rb   r`  )rM   r  rr  r  rs  r  rb   r?  )rM   r  r  r  rb   r?  )r  r  r  r  rb   r?  )r"  
__future__r   rt   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   rer   rQ  enumsr   r   r   r   installsr   r   modelsr   transformersr   r    r!   errorsr"   r#   r$   r%   r&   rW  r'   r(   r)   r*   r   r+   r   r,   r  r-   r  r/   utilsr0   r1   r2   r3   r4   r5   r6   typing_extensionsr7   r8   r9   interactionsr:   abcr;   r  r<   r=   rU  r>   _typesr?   discord.extr@   discord.permissionsrA   r#  __all__rV   rW   rX   rZ   Coror  Errorr  r  r[   CommandCallbackr   r   AutocompleteCallbackr[  THAI_COMBININGDEVANAGARI_COMBININGcompiler   ARG_NAME_SUBREGEXARG_DESCRIPTION_SUBREGEXARG_TYPE_SUBREGEX	MULTILINEry   r{   r|   r   r   r   r   r   r   r   r   r   r   r   r   rE   rB   rC   rD   rG   rF   rH   rJ   rK   rL   rM   rI   rN   rP   rO   rQ   rR   rS   rT   rU   r   rl   rj   <module>r     s
   0 # " " " " "                                      ( 
			 % % % % % % M M M M M M M M M M M M < < < < < < < <       M M M M M M M M M M y y y y y y y y y y y y y y ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^                   % % % % % % v v v v v v v v v v v v v v v v v v T@@@@@@@@@@******$$$$$$!!!!!!      
 %$$$$$666666+73T>9RRSI.  	#AAAGCLLGCxS)***		+	+	+c1+_=tCyHIf(/:DIEF	 	$%uT4:-='>>?
'
(  2V%7:;T!WDE/23T!W<=	?O
   	$f-tCy89$d+T#Y67$g.S	9:$eFDL&9:DIEF	H
 !&,c2DfWo9N4OOP$c*DfWo1F,GGH	J
 sDG|,O"3Q<0#CaL1 4mEegzz{  /p %2:i.&@CW&WZe&eff 2 Q  'RZe	ee'8eeKceeL  
 (RZD!DD*BDDL  
 'BJq	qq1BqqWoqqL     *          0 @H      2= = = =(> > > >8= = = =2= = = =07 7 7 7t, , , ,<   
j' j' j' j' j' j' j' j'ZE	 E	 E	 E	 E	gfal# E	 E	 E	Pg g g g g g g gTu	 u	 u	 u	 u	 u	 u	 u	t $+*1 $$8 8 8 8 8 8z $+ $$< < < < < <~5 5 5 5p) ) ) )XC C C CL9 9 9 9x: : : :z9 9 9 9x 
 9 9 9 9 
 9 
 ! ! ! 
 !* * * * *Z 
 C C C C 
 C 
 + + + 
 +* * * * *Z 
 6 6 6 6 
 6 
    
 ' ' ' ' 'T %,[b * * * * *Z 
 < < < < 
 < 
 $ $ $ 
 $& & & & &R 
 ; ; ; ; 
 ; 
 # # # 
 #& & & & &T ) ) ) ) )X? ? ? ? ? ? ?rl   