
    i                       d Z ddlm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 ddlZddlZddlmZ ddlmZmZmZ ddlmZmZ dd	lmZmZmZmZmZmZ dd
l m!Z!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z)m*Z* ddl+m,Z, ddl-m.Z. errddl/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z>m?Z?m@Z@ ddlmAZA  G d deAd          ZB G d deBd          ZC G d deCd          ZD G d deDd          ZEdZF ed           ZG ed!          ZH ed"d#$          ZI ed%d&$          ZJ ed'd($          ZK eLd          ZMerN e1d)          ZN e1d*          ZOeee2eIe5eNf         e6eG         f         ee2e5eNf         e6eG         f         f         ZPn ed)          ZN ed*          ZO G d+ d,          ZQd]d1ZRd]d2ZSd^d6ZT G d7 d8ejU                  ZV G d9 d:ejU                  ZW G d; d<ejU                  ZXd_dDZYd`dJZZ G dK dLej        j        eIeNeGf                   Z[ G dM dNeeIeNeGf                   Z\ G dO dPeeIeNeGf                   Z]efdQdRdadYZ^efdQdRdbd\Z_dS )ca:  
The MIT License (MIT)

Copyright (c) 2015-present Rapptz

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotations)TYPE_CHECKINGAnyCallableClassVarDictListTupleTypeTypeVarUnionOptionalN)app_commands)MISSINGmaybe_coroutine	async_all   )CommandGroup)BadArgumentCommandRegistrationErrorCommandErrorHybridCommandErrorConversionErrorDisabledCommand)	ConverterRangeGreedyrun_convertersCONVERTER_MAPPING)	Parameter)is_flagFlagConverter)Cog)
StringView)Self	ParamSpecConcatenateUnpack)ContextTCoroBotT)Bot)Context)CheckAutocompleteCallbackChoiceT)_CommandKwargsc                  B    e Zd ZU ded<   ded<   ded<   ded<   ded<   dS )	_HybridCommandKwargs	list[int]	guild_idsbool
guild_onlydefault_permissionsnsfwwith_app_commandN__name__
__module____qualname____annotations__     \/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/discord/ext/commands/hybrid.pyr4   r4   5   sK         !!!!


rB   r4   F)totalc                      e Zd ZU ded<   dS )_HybridCommandDecoratorKwargs#Union[str, app_commands.locale_str]descriptionNr<   rA   rB   rC   rF   rF   <   s         888888rB   rF   c                  V    e Zd ZU ded<   ded<   ded<   ded<   ded<   ded	<   ded
<   dS )_HybridGroupKwargsr7   r;   r5   r6   r8   r9   r:   strrH   case_insensitiveNr<   rA   rB   rC   rJ   rJ   ?   sc         !!!!


rB   rJ   c                  .    e Zd ZU ded<   ded<   ded<   dS )_HybridGroupDecoratorKwargsrG   rH   zOptional[str]fallbackz!Optional[app_commands.locale_str]fallback_localeNr<   rA   rB   rC   rN   rN   H   s6         8888::::::rB   rN   )HybridCommandHybridGrouphybrid_commandhybrid_groupTUCogTr$   )boundCommandTzCommand[Any, ..., Any]GroupTzGroup[Any, ..., Any]PP2c                  2    e Zd ZdZd
dZedd            Zd	S )_CallableDefaultfuncr`   Callable[[Context], Any]returnNonec                    || _         d S Nr_   )selfr`   s     rC   __init__z_CallableDefault.__init__m   s    .2			rB   r   c                    t           S re   )	_NoneTyperf   s    rC   	__class__z_CallableDefault.__class__p   s    rB   N)r`   ra   rb   rc   )rb   r   )r=   r>   r?   	__slots__rg   propertyrk   rA   rB   rC   r^   r^   j   sM        I3 3 3 3    X  rB   r^   	converterr   rb   r7   c                ~    t          j        |           rt          | t                    pt	          | t                    S re   )inspectisclass
issubclassr   
isinstancern   s    rC   is_converterru   u   s3    OI&&K:i+K+KpPZ[dfoPpPpprB   c                B    t          | d          pt          | d          S )N$__discord_app_commands_transformer__"__discord_app_commands_transform__)hasattrrt   s    rC   is_transformerrz   y   s.    9DEE 7J J rB   r`   Callable[..., Any]intc                    t          j        |           }t          d |j                                        D                       S )Nc              3  2   K   | ]}|j         |j        u V  d S re   )defaultempty).0ps     rC   	<genexpr>z)required_pos_arguments.<locals>.<genexpr>   s+      EEqyAG#EEEEEErB   )rp   	signaturesum
parametersvalues)r`   sigs     rC   required_pos_argumentsr      s=    

D
!
!CEES^-B-B-D-DEEEEEErB   c                  (     e Zd Zd fdZddZ xZS )ConverterTransformerrn   r   	parameterr!   rb   rc   c                .   t                                                       || _        || _        	 |j        }|F|                    d          r3|                    d          s t          j        ||          | _        d S d S d S d S # t          $ r Y d S w xY w)Nzdiscord.rn   )
superrg   rn   r   r>   
startswithendswithr    getAttributeError)rf   rn   r   modulerk   s       rC   rg   zConverterTransformer.__init__   s    '$-	M)F !v'8'8'D'D!V__]hMiMi!!2!6y)!L!L "!!!!!  	 	 	DD	s   B 
BBinteractiondiscord.InteractionvaluerK   c                 K   |j         }| j        }| j        |_        ||_        	 t          j        |          rnt          |t                    rYt          j	        |j
                  r|
                    ||           d {V S  |            
                    ||           d {V S t          |t                    r|
                    ||           d {V S d S # t          $ r  t          $ r}t          ||          |d }~ww xY wre   )_batonrn   r   current_parametercurrent_argumentrp   rq   rr   r   ismethodconvertrs   r   	Exceptionr   )rf   r   r   ctxrn   excs         rC   	transformzConverterTransformer.transform   sF      N	 $$	;y)) ;jI.N.N ;#I$566 A!*!2!23!>!>>>>>>>>!*!4!4S%!@!@@@@@@@@Iy11 ;&..sE:::::::::; ; 	 	 	 	; 	; 	;!)S11s:	;s$   AC #C '0C D.C??Drn   r   r   r!   rb   rc   r   r   r   rK   rb   r   r=   r>   r?   rg   r   __classcell__rk   s   @rC   r   r      sW        M M M M M M; ; ; ; ; ; ; ;rB   r   c                  (     e Zd Zd fdZddZ xZS )CallableTransformerr`   Callable[[str], Any]rb   rc   c                V    t                                                       || _        d S re   )r   rg   r`   )rf   r`   rk   s     rC   rg   zCallableTransformer.__init__   s$    *.			rB   r   r   r   rK   r   c                  K   	 |                      |          S # t          $ r  t          $ r#}t          d| j         j         d          |d }~ww xY w)NzConverting to "z" failed)r`   r   r   r   r=   )rf   r   r   r   s       rC   r   zCallableTransformer.transform   sx      	W99U### 	 	 	 	W 	W 	WL	0BLLLMMSVV	Ws    AAA)r`   r   rb   rc   r   r   r   s   @rC   r   r      sY        / / / / / /W W W W W W W WrB   r   c                  (     e Zd Zd fdZddZ xZS )GreedyTransformerrn   r   r   r!   rb   rc   c                d    t                                                       || _        || _        d S re   )r   rg   rn   r   )rf   rn   r   rk   s      rC   rg   zGreedyTransformer.__init__   s+    '$-rB   r   r   r   rK   c               &  K   t          |          }g }|j        }| j        x|_        }| j        }	 |                                 |                                x|_        }|n.t          ||||           d {V }	|	                    |	           `|S re   )
r%   r   r   r   rn   skip_wsget_quoted_wordr   r   append)
rf   r   r   viewresultr   r   rn   arg	converteds
             rC   r   zGreedyTransformer.transform   s      %   ,0N:	N		%LLNNN)-)=)=)?)??C 3{ -S)S)LLLLLLLLIMM)$$$	% rB   r   r   r   r   s   @rC   r   r      sQ        . . . . . .
       rB   r   paraminspect.Parametercallbackoriginalr!   mappingDict[str, inspect.Parameter]c           	     \   	 t           j                            |           n# t          $ r{ t	          |dd           }t	          |dg           }t          |t                    r<|}|                     t           j        |j        |j	        |j
        f                   } nt          |t                    rJ|j        }|t          j        u rt          d          |                     t          ||                    } nt!          |          rm| j        |f|_        i }	i }
|j                                        D ]}|j        }t-          j        || j        |j        t4          ur|j        nt,          j        j        |j                  }t9          ||j        |||          }||v rt          |d          |j        t4          ur
|j        |	|<   |j        |j        k    r
|j        |
|<   |j        |j        urC|                    t=          |j                  rt?          |j                  n|j                  }|||<   |	r t          j         di |	|           |
r t          j!        di |
|           n)tE          |          s	|tF          v r%|                     tI          ||                    } n|tJ          u rtM          |          dk    rp|d	         tN          u ra|d
         }tQ          |          }tE          |          s	|tF          v r1|s/|                     tR          tI          ||                             } n` |r t=          |          rMt-          j*        |          s9tW          |          }|dk    r |                     tY          |                    } Y nw xY w| S )N
__origin____args__
annotationzBdiscord.Attachment with Greedy is not supported in hybrid commands)namekindr   r   z+ flag would shadow a pre-existing parameterr      r   r   rA   )-r   transformersget_supported_annotation	TypeErrorgetattrrs   r   replacer   minmaxr   rn   discord
Attachmentr   r"   r   __hybrid_command_flag____commands_flags__r   	attributerp   r!   r   r   r   r   replace_parameterrH   callabler^   describerenameru   r    r   r   lenri   rz   r   rq   r   r   )r   rn   r   r   r   originargsrinnerdescriptionsrenamesflagr   
flag_parampseudois_inner_transformerparam_counts                    rC   r   r      s   GM!::9EEEE DM DM DML$77y*b11i'' @	MAMM\-?aeUVUZ@Z-[M\\EE	6** =	M 'E*** deeeMM->uh-O-OMPPEEY 4	M05
I/FH,LG!4;;== ' '~$.,0L,G,GDLLWM^Md#	  
 +:tRZ\cdd7??#t$Z$Z$Z[[[#722)-)9L&9..$(IGDM>55 $^^BJ4<BXBX j 0 > > >^b^j ,  F !'  @5%5555h??? 9.#..g..x888)$$ 	M	5F(F(FMM-A)X-V-VMWWEEu__4yyA~~$r(i"7"7Q'5e'<'<$ '' f54E+E+EOc+E!MMX>RSXZb>c>c5dMeeE 	Mi   	M)C)C 	M0;;KaMM-@-K-KMLLEIDML Ls   # NN)(N)r   Dict[str, Parameter]r   inspect.SignatureList[inspect.Parameter]c                X   |j                                         }|                                 D ]\  }}|j        }||                             |          }t          |||||          }|j        |j        urEt          |j                  rt          |j                  n|j        }|                    |          }t          |j        t                    r|                    |j                  }t          |d          r||= |||<   t          |                                          S )Nr   r   __commands_is_flag__)r   copyitemsrn   r   r   r   r   r   r^   rs   r!   ry   listr   )	r   r   r   paramsr   r   rn   r   r   s	            rC   replace_parametersr      s&    !&&((F%++--  i'	 t$$	$::!%HiPPIO33=EiFW=X=Xo&y'8999^g^oGMM'M22EemY// 	;MM)/M::E 9455 	tt   rB   c                  `     e Zd ZU dZded<   	 dd fdZd fdZddZddZddZ	ddZ
 xZS )HybridAppCommandTClassVar[bool]"__commands_is_hybrid_app_command__Nwrapped=Union[HybridCommand[CogT, ..., T], HybridGroup[CogT, ..., T]]r   -Optional[Union[str, app_commands.locale_str]]rb   rc   c                   t          j        |j                  }t          |j        |j        |          }|                    |          |j        _        t          |j        dd          }	 t                      	                    |p|j
        p|j        |j        |j        p|j        p|j        pd|           |j        `n# |j        `w xY w|| _        |j        | _        t          |j        dd           | _        |j        | _        d S )N)r    __discord_app_commands_is_nsfw__F   …)r   r   rH   r:   r   )rp   r   r   r   r   r   __signature__r   r   rg   _locale_namer   _locale_descriptionrH   	short_docr   cogbindingflag_converterr   )rf   r   r   r   r   r:   rk   s         rC   rg   zHybridAppCommand.__init__A  s   
 %g&677	#GNG4DiPP)2):):f):)M)M&w')KUSS	/GGAW1AW\ )#7l7;NlRYRclgl	      .. .....V]'.{IP7J
 J
 ns   -AC 	Cr&   c                j     t                      j        di |}| j        |_        | j        |_        |S )NrA   )r   
_copy_withr   r   rf   kwargsr   rk   s      rC   r   zHybridAppCommand._copy_with\  s8    'UWW'11&11|"1rB   c                b    | j         | j         i}|                     | j        | j         |          S )N)parentr   bindings)r   r   r  )rf   r  s     rC   r   zHybridAppCommand.copyb  s1    L$,
 dk4<RZ[[[rB   r   r   	namespaceapp_commands.NamespaceDict[str, Any]c                  K   |j         }i }| j                                        D ]}	 ||j                 }|                    ||           d {V ||j        <   5# t          $ rw |j        sXt          |j	        t                    r.t          |j	        j        |j                   d {V ||j        <   n%|j	        ||j        <   nt          j        |           d Y w xY w| j        | j        \  }}|                    |          }	|j                                        D ]V}
	 |                    |
j                  }t+          |	|
j        |           4# t          $ r t          j        |           d w xY w|	||<   |S re   )__dict___paramsr   display_namer   r   KeyErrorrequiredrs   r   r^   r   r`   r   r   CommandSignatureMismatchr   __new__r   popr   setattr)rf   r   r  r   transformed_valuesr   r   
param_nameflag_clsr   fs              rC   _transform_argumentsz%HybridAppCommand._transform_argumentsh  s      #\((** 	[ 	[E[u12 8={TY7Z7Z1Z1Z1Z1Z1Z1Z"5:..  P P P~ P!%-1ABB G?Nu}Oacncu?v?v9v9v9v9v9v9v*5:669>*5:66&?EE4OP *#'#6 J##H--D07799 6 66.221;??E D!+u5555   P P P&?EE4OP
 .2z*!!s   AA>CC E E1r7   c                  K   j         }j        |                    d           d {V sdS |                               d {V sdS | j        0| j        | j        ur"t          | j        j                   d {V sdS | j        r	 | j        j        }t          |           d {V }|sdS n# t          $ r Y nw xY wt          j	        | j        j
                  }|t          |           d {V }|sdS | j        r(t          fd| j        D                        d {V sdS | j        j        r-t          fd| j        j        D                        d {V sdS dS )NT)	call_onceFc              3  .   K   | ]} |          V  d S re   rA   )r   r  r   s     rC   r   z2HybridAppCommand._check_can_run.<locals>.<genexpr>  s+      .S.S!qq~~.S.S.S.S.S.SrB   c              3  .   K   | ]} |          V  d S re   rA   )r   r  r   s     rC   r   z2HybridAppCommand._check_can_run.<locals>.<genexpr>  s+      6[6[!qqvv6[6[6[6[6[6[rB   )clientr   can_runr  r   r   interaction_checkr   r$   _get_overridden_method	cog_checkchecksr   r   )rf   r   botcheckretlocal_checkr   s    `    @rC   _check_can_runzHybridAppCommand._check_can_run  s      %'.[[[55555555 	5[[%%%%%%%% 	5;"t{$,'F'F ))FTTTTTTTT u<#!)-)G ,E;???????? ! 5!	 "    4T\5KLLK&+K======== ! 5; 	Y.S.S.S.St{.S.S.S%S%SSSSSSS 	5< 	Y6[6[6[6[t|GZ6[6[6[-[-['['['['['['[ 	5ts   B5 5
CCr   c                  K   |j         }|                    |           d {V x|_        }| j        }|                    d|           d }d}	 |                    |           d {V  |                     ||j                   d {V }d}n2# t          j	        $ r  t          j
        t          j        f$ rv}t          |j        t                    r|j        }	nt          |          }	||	_        |                    ||	                    |j                             d {V  Y d }~nd }~wt          j        $ rT}t          |          }	||	_        |                    ||	                    |j                             d {V  Y d }~n6d }~wt          $ r&}|                    ||           d {V  Y d }~nd }~ww xY w|j        %|j                            |j                   d {V  |r|                    |           d {V  nO# |j        %|j                            |j                   d {V  |r|                    |           d {V  w w xY w|j        s|                    d|           |j        |_        |S )NcommandFTcommand_completion)r  get_contextr   r   dispatchprepare_do_callr   r   r  TransformerErrorCommandInvokeErrorrs   	__cause__r   r   dispatch_errorwith_traceback__traceback__AppCommandError_max_concurrencyreleasemessagecall_after_hookscommand_failed)
rf   r   r  r   r   r&  r   callback_completeder   s
             rC   _invoke_with_namespacez'HybridAppCommand._invoke_with_namespace  sB     %
 *-)E)E#E#E#E#E#E#EES,Y$$$"	4//#&&&&&&&&&--SZ88888888E!%4 	 	 	-|/NO 	S 	S 	S!+|44 "k(++ !((c.@.@.Q.QRRRRRRRRRRRRRR+ 	S 	S 	S$Q''CCM((c.@.@.Q.QRRRRRRRRRRRRRR 	1 	1 	1((a00000000000000	1 '3.66s{CCCCCCCCC! 4..s333333333	 '3.66s{CCCCCCCCC! 4..s33333333334 ! 	4LL-s333%(%7"sW   >B H
 *F=8A,D)$H
 )F=;A
F
H
 
F=F83H
 8F==H
 
AIre   )r   r   r   r   rb   rc   )rb   r&   )r   r   r  r  rb   r  )r   r   rb   r7   )r   r   r  r  rb   r   )r=   r>   r?   r   r@   rg   r   r   r  r$  r:  r   r   s   @rC   r   r   >  s         9=&====
 ?C% % % % % % %6     \ \ \ \!" !" !" !"F3 3 3 3j+ + + + + + + +rB   r   c                       e Zd ZU dZdZded<   eedd! fdZed"d            Z	ed#d            Z
e
j        d$d            Z
d% fdZd& fdZd' fdZd(d Z xZS ))rQ   a  A class that is both an application command and a regular text command.

    This has the same parameters and attributes as a regular :class:`~discord.ext.commands.Command`.
    However, it also doubles as an :class:`application command <discord.app_commands.Command>`. In order
    for this to work, the callbacks must have the same subset that is supported by application
    commands.

    These are not created manually, instead they are created via the
    decorator or functional interface.

    .. versionadded:: 2.0
    Tr   __commands_is_hybrid__)r   rH   r`   )CommandCallback[CogT, Context[Any], P, T]r   rG   rH   r   Unpack[_HybridCommandKwargs]rb   rc   c                 t          |t          j                  r	|j        |fn|d f\  }}|t          ur||d<   t          |t          j                  r	|j        |fn|d f\  }}|t          ur||d<    t                      j        |fi | |                    dd          | _        || _	        || _
        | j        rt          |           nd | _        d S )Nr   rH   r;   T)rs   r   
locale_strr5  r   r   rg   r  r;   r   r   r   app_command)rf   r`   r   rH   r   name_localedescription_localerk   s          rC   rg   zHybridCommand.__init__  s    5?t\E\4]4]oT\400dhjncokw!F6N2<[,Ja2b2b{[ +..itvzh{ 	(' g%%$/F=!(((((&,jj1CT&J&J?JFX  '+&;ET""" 	rB   (Optional[HybridAppCommand[CogT, Any, T]]c                    | j         S re   rA  rj   s    rC   __discord_app_commands_unwrap__z-HybridCommand.__discord_app_commands_unwrap__      rB   rW   c                    | j         S re   _cogrj   s    rC   r   zHybridCommand.cog  
    yrB   r   c                >    || _         | j        || j        _        d S d S re   )rK  rA  r   )rf   r   s     rC   r   zHybridCommand.cog!  s+    	'',D$$$ ('rB   r   Context[BotT]r7   c                  K   | j         st          | j         d          |j        ,| j        r%| j                            |j                   d {V S t                                          |           d {V S )Nz command is disabled)enabledr   r   r   rA  r$  r   r  )rf   r   rk   s     rC   r  zHybridCommand.can_run'  s      | 	F!TY"D"D"DEEE?&4+;&)88IIIIIIIII---------rB   c                   K   |j         }|'t                                          |           d {V S | j        r-| j                            ||j                   d {V |_        d S d S re   )r   r   _parse_argumentsrA  r  r  r   )rf   r   r   rk   s      rC   rR  zHybridCommand._parse_arguments0  s      o11#666666666 	i#/DD[R]RghhhhhhhhCJJJ	i 	irB   otherr&   c                    t                                          |          }| j        d |_        n*| j                                        |_        ||j        _        |S re   )r   _ensure_assignment_on_copyrA  r   r   rf   rS  r   rk   s      rC   rU  z(HybridCommand._ensure_assignment_on_copy7  sU    ww11%88##D#/4466D'+D$rB   rK   TCallable[[AutocompleteCallback[CogT, ChoiceT]], AutocompleteCallback[CogT, ChoiceT]]c                b    | j         t          d          | j                             |          S )a'  A decorator that registers a coroutine as an autocomplete prompt for a parameter.

        This is the same as :meth:`~discord.app_commands.Command.autocomplete`. It is only
        applicable for the application command and doesn't do anything if the command is
        a regular command.

        .. note::

            Similar to the :meth:`~discord.app_commands.Command.autocomplete` method, this
            takes :class:`~discord.Interaction` as a parameter rather than a :class:`Context`.

        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.
        Nz;This command does not have a registered application command)rA  r   autocomplete)rf   r   s     rC   rY  zHybridCommand.autocomplete@  s3    2 #YZZZ,,T222rB   )
r`   r=  r   rG   rH   rG   r   r>  rb   rc   )rb   rD  rb   rW   r   rW   rb   rc   r   rN  rb   r7   r   rN  rb   rc   rS  r&   rb   r&   r   rK   rb   rW  )r=   r>   r?   __doc__r<  r@   r   rg   rm   rG  r   setterr  rR  rU  rY  r   r   s   @rC   rQ   rQ     sE          .21111 5<;B
 
 
 
 
 
 
 
6       X     X 	Z- - - Z-
. . . . . .i i i i i i     3 3 3 3 3 3 3 3rB   rQ   c                      e Zd ZU dZdZded<   eeddd6 fdZed7d            Z	ed8d            Z
ed9d            Zej        d:d            Zd; fdZd< fdZd= fd"Zd> fd%Zd?d(Zd@d+ZdA fd-Zefdd.dBd2Zefdd.dCd5Z xZS )DrR   a  A class that is both an application command group and a regular text group.

    This has the same parameters and attributes as a regular :class:`~discord.ext.commands.Group`.
    However, it also doubles as an :class:`application command group <discord.app_commands.Group>`.
    Note that application commands groups cannot have callbacks associated with them, so the callback
    is only called if it's not invoked as an application command.

    Hybrid groups will always have :attr:`Group.invoke_without_command` set to ``True``.

    These are not created manually, instead they are created via the
    decorator or functional interface.

    .. versionadded:: 2.0

    Attributes
    -----------
    fallback: Optional[:class:`str`]
        The command name to use as a fallback for the application command. Since
        application command groups cannot be invoked, this creates a subcommand within
        the group that can be invoked with the given group callback. If ``None``
        then no fallback command is given. Defaults to ``None``.
    fallback_locale: Optional[:class:`~discord.app_commands.locale_str`]
        The fallback command name's locale string, if available.
    Tr   r<  N)r   rH   rO   r   r   r   rG   rH   rO   r   attrsUnpack[_HybridGroupKwargs]rb   rc   c          
        t          |t          j                  r	|j        |fn|d f\  }}|t          ur||d<   t          |t          j                  r	|j        |fn|d f\  }}|t          ur||d<    t                      j        |i | d| _        |                    dd          | _	        || _
        || _        d }| j        Ct          | j        t                    r| j        j        }nt          d| j        j                   t          | _        t          |t          j                  r	|j        |fn|d f\  }}	|| _        |	| _        | j	        r6|                    dd           }
|
t'          | j        dd           }
t'          | j        dd	          }t'          | j        d
d           }t'          | j        dd	          }t'          | j        dt                    }t'          | j        dt                    }t          j        | j
        p| j        | j        p| j        p| j        pd|
|||||          | _        || j        _        | j        | j        _        |1t5          | |	p|          }| j                            |           d S d S d S )Nr   rH   Tr;   z+HybridGroup parent must be HybridGroup not r6   '__discord_app_commands_default_guilds__#__discord_app_commands_guild_only__F,__discord_app_commands_default_permissions__r   !__discord_app_commands_contexts__+__discord_app_commands_installation_types__r   )r   rH   r6   r8   r9   r:   allowed_installsallowed_contexts)r   )rs   r   r@  r5  r   r   rg   invoke_without_commandr  r;   r   r   r  rR   rA  r   rk   rO   rP   r   r   r   r   rH   r   r   r   add_command)rf   r   rH   rO   r   rc  rB  rC  r  rP   r6   r8   r9   r:   contextsinstallsr&  rk   s                    rC   rg   zHybridGroup.__init__{  s    5?t\E\4]4]oT\400dhjncokw E&M2<[,Ja2b2b{[ +..itvzh{ 	(' g%%#.E- $(%(((&*#&+ii0BD&I&I?JFX ;"$+{33 g0 edkNc e efff
 07 -7xAX,Y,YoXx((`hjn_o 	"/ (0BQ  	6		+t44I #DM3\^bcc	 0UW\]]J")$-9gim"n"n4=*LeTTDt}.QSZ[[Ht}.[]deeH+1&3$) 4c8HcDNc^c#%$7!)!)	  	  	 D '-D#&*kD##*4o6QRRR ,,W555555	6 	60 $#rB   (Optional[HybridAppCommand[CogT, ..., T]]c                `    | j         t          u rd S | j                             | j                  S re   )rA  r   get_commandrO   rj   s    rC   _fallback_commandzHybridGroup._fallback_command  s.    w&&4++DM:::rB   Optional[app_commands.Group]c                    | j         S re   rF  rj   s    rC   rG  z+HybridGroup.__discord_app_commands_unwrap__  rH  rB   rW   c                    | j         S re   rJ  rj   s    rC   r   zHybridGroup.cog  rL  rB   r   c                8    || _         | j        }|r	||_        d S d S re   )rK  rt  r   )rf   r   rO   s      rC   r   zHybridGroup.cog  s1    	) 	%$H	% 	%rB   r   rN  r7   c                  K   | j         }|j        "|r |                    |j                   d {V S t                                          |           d {V S re   )rt  r   r$  r   r  )rf   r   rO   rk   s      rC   r  zHybridGroup.can_run  sl      )?&8&!00AAAAAAAAA---------rB   c                   K   |j         }| j        }|*|r(|                    ||j                   d {V |_        d S t                                          |           d {V S re   )r   rt  r  r  r   r   rR  )rf   r   r   rO   rk   s       rC   rR  zHybridGroup._parse_arguments  s{      o)"x"'<<[+J_````````CJJJ11#666666666rB   rS  r&   c                b    t                                          |          }| j        |_        |S re   )r   rU  rO   rV  s      rC   rU  z&HybridGroup._ensure_assignment_on_copy  s(    ww11%88rB   r   r  c                    t                                          |          }|j        r/| j        r(| j        j                                        |j        _        |j        r| j        r||j        _        |S re   )r   _update_copyrA  	_childrenr   rt  r   r   s      rC   r}  zHybridGroup._update_copy  sy    ww##F++  	K 0 	K *.)9)C)H)H)J)JD& ! 	2d&< 	2-1D"*rB   rK   rW  c                P    | j         r| j                             |          S dd}|S )a  A decorator that registers a coroutine as an autocomplete prompt for a parameter.

        This is the same as :meth:`~discord.app_commands.Command.autocomplete`. It is only
        applicable for the application command and doesn't do anything if the command is
        a regular command.

        This is only available if the group has a fallback application command registered.

        .. note::

            Similar to the :meth:`~discord.app_commands.Command.autocomplete` method, this
            takes :class:`~discord.Interaction` as a parameter rather than a :class:`Context`.

        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`   #AutocompleteCallback[CogT, ChoiceT]rb   c                    | S re   rA   r_   s    rC   	decoratorz+HybridGroup.autocomplete.<locals>.decorator  s    rB   N)r`   r  rb   r  )rt  rY  )rf   r   r  s      rC   rY  zHybridGroup.autocomplete  sB    6 ! 	)66t<<<    rB   r&  AUnion[HybridGroup[CogT, ..., Any], HybridCommand[CogT, ..., Any]]c                  t          |t          t          f          st          d          t          |t                    r| j        t          |j        d          |j        r&| j        r| j                            |j                   | |_        |j	        | j
        v rt          |j	                  || j
        |j	        <   |j        D ]@}|| j
        v r+|                     |j	                   t          |d          || j
        |<   AdS )aL  Adds a :class:`.HybridCommand` into the internal list of commands.

        This is usually not called, instead the :meth:`~.GroupMixin.command` or
        :meth:`~.GroupMixin.group` shortcut decorators are used instead.

        Parameters
        -----------
        command: :class:`HybridCommand`
            The command to add.

        Raises
        -------
        CommandRegistrationError
            If the command or its alias is already registered by different command.
        TypeError
            If the command passed is not a subclass of :class:`.HybridCommand`.
        zEThe command passed must be a subclass of HybridCommand or HybridGroupNz; is too nested, groups can only be nested at most one levelT)alias_conflict)rs   rQ   rR   r   r  
ValueErrorqualified_namerA  rn  r   all_commandsr   aliasesremove_command)rf   r&  aliass      rC   rn  zHybridGroup.add_command  s&   & 'M;#?@@ 	ecdddg{++ 	w0G 6uuuvvv 	>4#3 	>(()<===<4,,,*7<888*1','_ 	/ 	/E)))##GL111.uTJJJJ'.De$$		/ 	/rB   !Optional[Command[CogT, ..., Any]]c                   t                                          |          }| j        r| j                            |           |S re   )r   r  rA  )rf   r   cmdrk   s      rC   r  zHybridGroup.remove_commandF  sA    gg$$T** 	2++D111
rB   r;   r;   %Unpack[_HybridCommandDecoratorKwargs]NCallable[[CommandCallback[CogT, ContextT, P2, U]], HybridCommand[CogT, P2, U]]c               $     d fd}|S )a`  A shortcut decorator that invokes :func:`~discord.ext.commands.hybrid_command` and adds it to
        the internal command list via :meth:`add_command`.

        Returns
        --------
        Callable[..., :class:`HybridCommand`]
            A decorator that converts the provided method into a Command, adds it to the bot, then returns it.
        r`   &CommandCallback[CogT, ContextT, P2, U]c                                         d            t          d|           }                    |           |S Nr  r   r;   )
setdefaultrS   rn  r`   r   r   r   r   rf   r;   s     rC   r  z&HybridGroup.command.<locals>.decorator\  sX    h---b^GWbb[abbcghhFV$$$MrB   r`   r  rA   rf   r   r;   r   r   r  s   ````` rC   r&  zHybridGroup.commandL  A     	 	 	 	 	 	 	 	 	 	 rB   #Unpack[_HybridGroupDecoratorKwargs]LCallable[[CommandCallback[CogT, ContextT, P2, U]], HybridGroup[CogT, P2, U]]c               $     d fd}|S )ag  A shortcut decorator that invokes :func:`~discord.ext.commands.hybrid_group` and adds it to
        the internal command list via :meth:`~.GroupMixin.add_command`.

        Returns
        --------
        Callable[..., :class:`HybridGroup`]
            A decorator that converts the provided method into a Group, adds it to the bot, then returns it.
        r`   r  c                                         d            t          d|           }                    |           |S r  )r  rT   rn  r  s     rC   r  z$HybridGroup.group.<locals>.decoratort  sX    h---`\dtEU``Y_``aeffFV$$$MrB   r  rA   r  s   ````` rC   groupzHybridGroup.groupd  r  rB   )r   r   r   rG   rH   rG   rO   r   rc  rd  rb   rc   )rb   rq  )rb   ru  rZ  r[  r\  r]  r^  )r   r  rb   r&   r_  )r&  r  rb   rc   )r   rK   rb   r  )
r   rG   r   r   r;   r7   r   r  rb   r  )
r   rG   r   r   r;   r7   r   r  rb   r  )r=   r>   r?   r`  r<  r@   r   rg   rm   rt  rG  r   ra  r  rR  rU  r}  rY  rn  r  r&  r  r   r   s   @rC   rR   rR   _  s         2 .21111
 5<;BBFB6 B6 B6 B6 B6 B6 B6 B6H ; ; ; X;
       X     X 	Z% % % Z%. . . . . .7 7 7 7 7 7     
     $" " " "H&/ &/ &/ &/P      5< "&	     4 5< "&	         rB   rR   Tr  r   rG   r;   rc  r  LCallable[[CommandCallback[CogT, ContextT, P, T]], HybridCommand[CogT, P, T]]c                    d fd}|S )a  A decorator that transforms a function into a :class:`.HybridCommand`.

    A hybrid command is one that functions both as a regular :class:`.Command`
    and one that is also a :class:`app_commands.Command <discord.app_commands.Command>`.

    The callback being attached to the command must be representable as an
    application command callback. Converters are silently converted into a
    :class:`~discord.app_commands.Transformer` with a
    :attr:`discord.AppCommandOptionType.string` type.

    Checks and error handlers are dispatched and called as-if they were commands
    similar to :class:`.Command`. This means that they take :class:`Context` as
    a parameter rather than :class:`discord.Interaction`.

    All checks added using the :func:`.check` & co. decorators are added into
    the function. There is no way to supply your own checks through this
    decorator.

    .. versionadded:: 2.0

    Parameters
    -----------
    name: Union[:class:`str`, :class:`~discord.app_commands.locale_str`]
        The name to create the command with. By default this uses the
        function name unchanged.
    with_app_command: :class:`bool`
        Whether to register the command also as an application command.
    \*\*attrs
        Keyword arguments to pass into the construction of the
        hybrid command.

    Raises
    -------
    TypeError
        If the function is not a coroutine or is already a command.
    r`   %CommandCallback[CogT, ContextT, P, T]rb   HybridCommand[CogT, P, T]c                l    t          | t                    rt          d          t          | fdS NzCallback is already a command.r  )rs   r   r   rQ   r`   rc  r   r;   s    rC   r  z!hybrid_command.<locals>.decorator  sC    dG$$ 	><===TY?OYYSXYYYrB   )r`   r  rb   r  rA   r   r;   rc  r  s   ``` rC   rS   rS   }  s>    VZ Z Z Z Z Z Z Z rB   r  JCallable[[CommandCallback[CogT, ContextT, P, T]], HybridGroup[CogT, P, T]]c                    d fd}|S )ae  A decorator that transforms a function into a :class:`.HybridGroup`.

    This is similar to the :func:`~discord.ext.commands.group` decorator except it creates
    a hybrid group instead.

    Parameters
    -----------
    name: Union[:class:`str`, :class:`~discord.app_commands.locale_str`]
        The name to create the group with. By default this uses the
        function name unchanged.
    with_app_command: :class:`bool`
        Whether to register the command also as an application command.

    Raises
    -------
    TypeError
        If the function is not a coroutine or is already a command.
    r`   r  rb   HybridGroup[CogT, P, T]c                l    t          | t                    rt          d          t          | fdS r  )rs   r   r   rR   r  s    rC   r  zhybrid_group.<locals>.decorator  sC    dG$$ 	><===4Wd=MWWQVWWWrB   )r`   r  rb   r  rA   r  s   ``` rC   rT   rT     s=    2X X X X X X X X
 rB   )rn   r   rb   r7   )r`   r{   rb   r|   )r   r   rn   r   r   r{   r   r!   r   r   rb   r   )r   r   r   r{   r   r   rb   r   )r   rG   r;   r7   rc  r  rb   r  )r   rG   r;   r7   rc  r  rb   r  )`r`  
__future__r   typingr   r   r   r   r   r	   r
   r   r   r   r   r   rp   r   discord.utilsr   r   r   corer   r   errorsr   r   r   r   r   r   rn   r   r   r   r   r    r   r!   flagsr"   r#   r   r$   r   r%   typing_extensionsr&   r'   r(   r)   _typesr*   r+   r,   r   r-   contextr.   discord.app_commands.commandsr/   AppCommandCheckr0   r1   r2   r4   rF   rJ   rN   __all__rU   rV   rW   rY   rZ   typeri   r[   r\   CommandCallbackr^   ru   rz   r   Transformerr   r   r   r   r   r   rQ   rR   rS   rT   rA   rB   rC   <module>r     s0   0 # " " " " " l l l l l l l l l l l l l l l l l l l l l l l l l l               = = = = = = = = = =                 } } } } } } } } } } } } } } } } R R R R R R R R R R R R R R ! ! ! ! ! ! ) ) ) ) ) ) ) )             ";FFFFFFFFFFFF,,,,,,,,,,               
 %$$$$$    ~U    9 9 9 9 9(<E 9 9 9 9    :%    ; ; ; ; ;&8 ; ; ; ; GCLLGCLLwvU###7:%=>>>	!7	8	8	8DJJ	 
	#A	4BT8Q./a89Xq[)4723	5OO
 	A	B       q q q q   F F F F
; ; ; ; ;<3 ; ; ;BW W W W W,2 W W W    0   4P P P Pf! ! ! !<m m m m mw+3D!QJ? m m m`n3 n3 n3 n3 n3GD!QJ' n3 n3 n3b[ [ [ [ [%a
# [ [ [~ 181 "1 1 1 1 1 1j 18 "       rB   