
    cjh9                       d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZ ddlmZmZmZmZmZmZmZ ddlm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" dd
l#m$Z$m%Z%m&Z& ddl'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m*Z* ddl/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5 edeeeef   f   Z6 ede6      Z7dZ8 ejr                  e:      Z; G d de      Z< G d de<ee      Z= G d de=e      Z> G d de=e-      Z?y)ae  
The MIT License (MIT)

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

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

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
    )annotationsN)ABCabstractmethod)AnyCallable	Coroutine	GeneratorLiteralMappingTypeVar   )Client)CogMixin)ApplicationCommandApplicationContextAutocompleteContextMessageCommandSlashCommandSlashCommandGroupUserCommandcommand)IntegrationTypeInteractionContextTypeInteractionType)CheckFailureDiscordException)Interaction)AutoShardedClient)interactions)User)MISSING	async_allfindget.CFT)bound)ApplicationCommandMixinBotAutoShardedBotc                      e Zd ZdZd! fdZed        Zed        Zed"d       Zed#d       Z	d$dZ
	 	 	 	 d%dZed	        Zd
ef	 	 	 	 	 	 	 d&dZ	 	 d'	 	 	 	 	 d(dZ	 	 d)	 	 	 	 	 	 	 d*dZ	 	 	 	 	 d+	 	 	 	 	 	 	 	 	 	 	 d,dZd
ddd
dg df	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d-dZ	 d.	 	 	 	 	 d/dZ	 	 	 	 	 	 d0dZd Zd Zd Zd Zd Z	 	 d'	 	 	 	 	 	 	 d1dZ	 	 	 d2	 	 	 	 	 	 	 d3dZeZd4dZef	 	 	 	 	 d5dZe f	 	 	 	 	 d6dZ!d7dZ"ee#d8d               Z$ xZ%S )9r'   a  A mixin that implements common functionality for classes that need
    application command compatibility.

    Attributes
    ----------
    application_commands: :class:`dict`
        A mapping of command id string to :class:`.ApplicationCommand` objects.
    pending_application_commands: :class:`list`
        A list of commands that have been added but not yet registered. This is read-only and is modified via other
        methods.
    c                @    t        |   |i | g | _        i | _        y N)super__init___pending_application_commands_application_commands)selfargskwargs	__class__s      >/var/www/html/venv/lib/python3.12/site-packages/discord/bot.pyr.   z ApplicationCommandMixin.__init__T   s%    $)&)-/*%'"    c                    | j                   S r,   )r0   r1   s    r5   all_commandsz$ApplicationCommandMixin.all_commandsY   s    )))r6   c                    | j                   S r,   )r/   r8   s    r5   pending_application_commandsz4ApplicationCommandMixin.pending_application_commands]   s    111r6   c                    | j                   }| j                  j                  r/t        | j                  d      r|t	        | j                  d      z  }|S )Nprefixed_commands)application_commands_bot_supports_prefixed_commandshasattrgetattr)r1   commandss     r5   rC   z ApplicationCommandMixin.commandsa   sH    ,,9900WII*6
 		+>??Hr6   c                H    t        | j                  j                               S r,   )listr0   valuesr8   s    r5   r>   z,ApplicationCommandMixin.application_commandsj   s    D..55788r6   c                z   t        |t              r|j                  rt        d      | j                  j
                  r'|j                  | j                  j
                  |_        | j                  j                  r'|j                  | j                  j                  |_        | j                  j                  r'|j                  | j                  j                  |_
        | j                  D ]3  }||k(  s	|j                  |_        || j                  |j                  <    n | j                  j                  |       y)a]  Adds an :class:`.ApplicationCommand` into the internal list of commands.

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

        .. versionadded:: 2.0

        Parameters
        ----------
        command: :class:`.ApplicationCommand`
            The command to add.
        z.The provided command is a sub-command of groupN)
isinstancer   is_subcommand	TypeErrorr?   debug_guilds	guild_idsdefault_command_contextscontexts!default_command_integration_typesintegration_typesr;   idr0   r/   append)r1   r   cmds      r5   add_application_commandz/ApplicationCommandMixin.add_application_commandn   s     g|,1F1FLMM99!!g&7&7&? $		 6 6G99--'2B2B2J#yyAAGII77))1(,		(S(SG%44 	Cg~ VV
9@**7::6		
 	**11':r6   c                    |j                   r&| j                  j                  |j                   d       || j                  v r| j                  j	                  |       |S y)a  Remove an :class:`.ApplicationCommand` from the internal list
        of commands.

        .. versionadded:: 2.0

        Parameters
        ----------
        command: :class:`.ApplicationCommand`
            The command to remove.

        Returns
        -------
        Optional[:class:`.ApplicationCommand`]
            The command that was removed. If the command has not been added,
            ``None`` is returned instead.
        N)rQ   r0   popr/   remover1   r   s     r5   remove_application_commandz2ApplicationCommandMixin.remove_application_command   sQ    & ::&&**7::t<d888..55g>N 9r6   c                    | j                   S )zShortcut for :meth:`.get_application_command`.

        .. note::
            Overridden in :class:`ext.commands.Bot`.

        .. versionadded:: 2.0
        )get_application_commandr8   s    r5   get_commandz#ApplicationCommandMixin.get_command   s     +++r6   Nc                ^   | j                   j                         }|D ]  }|j                  |k(  r#t        ||      r||j                  |k7  r y|c S |j                         x}d   |j                  k(  sYt        |t              sjt        |      dkD  rZt        ||j                  d            }t        |t              r||j                  |k7  r y|j                  }t        |      dkD  rZt        ||j                               }t        ||      r||j                  |k7  r y|c S  y)at  Get an :class:`.ApplicationCommand` from the internal list
        of commands.

        .. versionadded:: 2.0

        Parameters
        ----------
        name: :class:`str`
            The qualified name of the command to get.
        guild_ids: List[:class:`int`]
            The guild ids associated to the command to get.
        type: Type[:class:`.ApplicationCommand`]
            The type of the command to get. Defaults to :class:`.ApplicationCommand`.

        Returns
        -------
        Optional[:class:`.ApplicationCommand`]
            The command that was requested. If not found, returns ``None``.
        Nr   r   name)r0   rF   r_   rH   rL   splitr   lenr$   rV   subcommands)r1   r_   rL   typerC   r   namess          r5   r[   z/ApplicationCommandMixin.get_application_command   s   2 --446 	G||t#
7D(A(W->->)-K::<'%+w||;
*A %j1n!(1>G%g/@A!-'2C2Cy2P&22H %j1n hUYY[9!'40)g.?.?9.L)	r6   c           	     p  K   dfdg }| j                   j                         }||D cg c]  }|j                  | }}n)|D cg c]  }|j                  ||j                  v r|  }}g }||}n| j                  j                  r|L| j                  j
                  j                  | j                  j                  j                         d{   }nL| j                  j
                  j                  | j                  j                  j                  |       d{   }|D ci c]  }|d   |
 }}|D ]  }|j                  |j                        }	|	|j                  |dd       5 ||	      r/|j                  |dt        ||j                     d         d       m|j                  |dt        |	d         d        |j                         D ]B  \  }}
t        |||   d   	      }	|	|j                  ||   d   t        |
d         d
d       D |S c c}w c c}w 7 X7 c c}w w)at  |coro|

        Gets the list of commands that are desynced from discord. If ``guild_id`` is specified, it will only return
        guild commands that are desynced from said guild, else it will return global commands.

        .. note::
            This function is meant to be used internally, and should only be used if you want to override the default
            command registration behavior.

        .. versionadded:: 2.0

        Parameters
        ----------
        guild_id: Optional[:class:`int`]
            The guild id to get the desynced commands for, else global commands if unspecified.
        prefetched: Optional[List[:class:`.ApplicationCommand`]]
            If you already fetched the commands, you can pass them here to be used. Not recommended for typical usage.

        Returns
        -------
        List[Dict[:class:`str`, Any]]
            A list of the desynced commands. Each will come with at least the ``cmd`` and ``action`` keys, which
            respectively contain the command and the action to perform. Other keys may also be present depending on
            the action, including ``id``.
        c           
        t        | t              rt        | j                        t        |j	                  dg             k7  ryt        | j                        D ]5  \  }t        fd|d   D        t              }|t        us+ |      s5 y y| j                         }d d d d d d g dd d d	}|j                         D ]  \  }}t        ||         t        k(  rdg f}|D ]  }	||v r'||   D 
cg c]  }
|
j	                  |	t               c}
ng }t        |      D ]  \  }}
|
|v st        ||<    |j	                  |t              t        usn|||   D 
cg c]  }
|
j	                  |	t               c}
k7  s  y t        | |d       |j	                  |      k7  s|dk(  r!t        | |      du r|j	                  |       y yc c}
w c c}
w )NoptionsTc              3  F   K   | ]  }|d    j                   k(  r|  yw)r_   Nr^   ).0data
subcommands     r5   	<genexpr>zXApplicationCommandMixin.get_desynced_commands.<locals>._check_command.<locals>.<genexpr>  s)       $#F|z> !s   !)rc   r_   descriptionautocompletechoicesname_localizationsdescription_localizations)	nsfwdefault_member_permissionsr_   rm   rp   rq   rg   rN   rP   Fdefault_permission)rH   r   ra   rb   r$   	enumeratenextr!   to_dictitemsrc   rE   rB   )rS   matchimatch_as_dictto_checkcheckvalue
falsy_valsoptvalcmd_valsrk   _check_commands               @r5   r   zEApplicationCommandMixin.get_desynced_commands.<locals>._check_command  s   #01s'3uyyB/G+HH%.s%? 
$MAz!(-i(8
  F W,
F1S#
$@ i ++- 26 #'*.15  !%)-#& %-NN$4 $LE5HUO,4 ',R[
#( ,C $)G#3 CJ%. Q3g!6 Q%' %
 +4H*= :3#&*#429HQK:  %yy %w %, -19AFu>:=W 5> 2 (,,  !eT2eii6FF "%99 'U 3t ; %		% 0 8 %#?$@ 3 !R>s   1GG
Nr_   upsert)r   actioneditrQ   )r   r   rQ   r^   delete)r   rQ   r   )rS   r   ry   zMapping[str, Any]returnbool)r;   copyrL   r?   userhttpget_global_commandsrQ   get_guild_commandsr$   r_   rR   intrx   )r1   guild_id
prefetchedreturn_valuecmdsrS   pendingregistered_commandsregistered_commands_dictry   value_r   s              @r5   get_desynced_commandsz-ApplicationCommandMixin.get_desynced_commands   sU    BD	L 00557&*Dscmm.CsDGD  ==,S]]1J G  FH!",YY^^,0IINN,N,NIINN%%- '# -1IINN,M,MIINN%%x- '# AT#TCK$4#T #T 	C,00:E}##x$HIU+###&"(!":388"DT"JK ## #t3uT{;KL	( 499; 	KC&>s&CF&KLE}###;C#@#H!&,/"* 	 s E'' $UsZ   )H6H!H!H6	#H&,A'H6H+AH6 H.!H6)H16B?H666H6.H61H6Tc                   K   t         w)a  |coro|

        Registers a command. If the command has ``guild_ids`` set, or if the ``guild_ids`` parameter is passed,
        the command will be registered as a guild command for those guilds.

        Parameters
        ----------
        command: :class:`~.ApplicationCommand`
            The command to register.
        force: :class:`bool`
            Whether to force the command to be registered. If this is set to False, the command will only be registered
            if it seems to already be registered and up to date with our internal cache. Defaults to True.
        guild_ids: :class:`list`
            A list of guild ids to register the command for. If this is not set, the command's
            :attr:`ApplicationCommand.guild_ids` attribute will be used.

        Returns
        -------
        :class:`~.ApplicationCommand`
            The command that was registered
        )NotImplementedError)r1   r   forcerL   s       r5   register_commandz(ApplicationCommandMixin.register_command  s     8 "!s   	bulkFc           
     F   K   | j                   }|D cg c]  }t        j                  |       }}|D ]  }g}||_         du }g }	|rt        t	        d |            }
 j
                  j                  j                   j
                  j                  j                   j
                  j                  j                   j
                  j                  j                  d	 	 d% fdnt        t	        fd|            }
 j
                  j                  j                   j
                  j                  j                   j
                  j                  j                   j
                  j                  j                  d	 	 d% fdddd	 	 	 	 	 d&fd}g }|sg } j
                  j                  rL j
                  j                  j!                   j
                  j                  j"                         d{   }nL j
                  j                  j%                   j
                  j                  j"                         d{   } j'                  |	       d{   }|D ]  }|d
   dk(  r<|j)                  |rdnd t+        j,                  ddg      |d         |d   d       Gt/        |
|d   j0                  |d   j2                        }|r|d
   dk(  r|j)                  d||d   d       |d
   dk(  r|j)                  d|d       |d
   |j)                  d|d       t5        d|d
           t        t	        d |            }t        t	        d |            }|dk(  s|dk(  rt7        |      t7        |
      k(  r|D cg c]  }|d   j9                          }}t7        |      dk(  rt:        j=                  d       |}	n*t:        j=                  d|D ci c]  }|d   j0                  |d
    c}        |d|d       d{   }	n|sg }	|D ]  }|d
   dk(  r% |d|d   |d   j0                         d{    0|d
   dk(  rF|	j)                   |d|d   |d   j9                         |d   j0                         d{          ~|d
   dk(  rB|	j)                   |d|d   j9                         |d   j0                         d{          t5        d|d
           |dk7  r j
                  j                  rˉL j
                  j                  j!                   j
                  j                  j"                         d{   }	n} j
                  j                  j%                   j
                  j                  j"                         d{   }	n0|
D cg c]  }|j9                          }} |d|        d{   }	|	D ]u  }t/         j                   |d   |j/                  d!            }|s$t5        d"|d    d#|j/                  d!       d$      |d   |_        | j>                  |j"                  <   w |	S c c}w 7 p7 &7 c c}w c c}w 7 `7 -7 7 7 #7 c c}w 7 w)'a8  |coro|

        Register a list of commands.

        .. versionadded:: 2.0

        Parameters
        ----------
        commands: Optional[List[:class:`~.ApplicationCommand`]]
            A list of commands to register. If this is not set (``None``), then all commands will be registered.
        guild_id: Optional[int]
            If this is set, the commands will be registered as a guild command for the respective guild. If it is not
            set, the commands will be registered according to their :attr:`ApplicationCommand.guild_ids` attribute.
        method: Literal['individual', 'bulk', 'auto']
            The method to use when registering the commands. If this is set to "individual", then each command will be
            registered individually. If this is set to "bulk", then all commands will be registered in bulk. If this is
            set to "auto", then the method will be determined automatically. Defaults to "bulk".
        force: :class:`bool`
            Registers the commands regardless of the state of the command on Discord. This uses one less API call, but
            can result in hitting rate limits more often. Defaults to False.
        delete_existing: :class:`bool`
            Whether to delete existing commands that are not in the list of commands to register. Defaults to True.
        Nc                    | j                   d u S r,   rL   cs    r5   <lambda>z;ApplicationCommandMixin.register_commands.<locals>.<lambda>  s    AKK4,? r6   )r   r   r   r   c                     |    j                   j                  xr  j                   j                  j                  g|i |S r,   r?   r   rQ   )methodr2   r3   registration_methodsr1   s      r5   	_registerz<ApplicationCommandMixin.register_commands.<locals>._register  sH     4+F3IINN8tyy~~'8'8;?CI r6   c                @    | j                   d uxr | j                   v S r,   r   )r   r   s    r5   r   z;ApplicationCommandMixin.register_commands.<locals>.<lambda>  s    akk5Q(akk:Q r6   c                     |    j                   j                  xr  j                   j                  j                  g|i |S r,   r   )r   r2   r3   r   r   r1   s      r5   r   z<ApplicationCommandMixin.register_commands.<locals>._register  sJ     4+F3IINN8tyy~~'8'8(EIMS r6   )cmd_namer   c               x   |j                  dd      r| dk(  r0t        j                  d|d   D cg c]  }|d   	 c} d|        nb| dk(  rt        j                  d	| d|        nA| d
k(  rt        j                  d| d|        n | dk(  rt        j                  d| d|         | g|i |S c c}w )N_logTr   zBulk updating commands r   r_   z for guild r   zCreating command r   zEditing command r   zDeleting command )rV   r   debug)r   r   r   r2   r3   r   r   s         r5   registerz;ApplicationCommandMixin.register_commands.<locals>.register  s     zz&$'V#JJ1d1g2N1V92N1O P""*- x'JJ!28*KzRSv%JJ!1(;xjQRx'JJ!28*KzRSV5d5f55 3Os   B7
)r   r   r   r   Commandr_   r   r^   rQ   )r   r   rQ   )r_   rc   r   r   )r   r   zUnknown action: c                    | d   d uS )Nr    r   s    r5   r   z;ApplicationCommandMixin.register_commands.<locals>.<lambda>J  s    8D!8 r6   c                    | d   dk7  S )Nr   r   r   )as    r5   r   z;ApplicationCommandMixin.register_commands.<locals>.<lambda>M  s    8!8 r6   r   autor   z5Skipping bulk command update: Commands are up to datez&Bulk updating commands %s for guild %sF)r   )r   rc   zRegistered command z, type z not found in pending commands)r   +Literal['bulk', 'upsert', 'delete', 'edit'])r   r   r   strr   
int | None) r;   r   rL   rE   filterr?   r   bulk_upsert_global_commandsupsert_global_commanddelete_global_commandedit_global_commandbulk_upsert_guild_commandsupsert_guild_commanddelete_guild_commandedit_guild_commandr   r   rQ   r   r   rR   collections
namedtupler$   r_   rc   
ValueErrorra   rw   r   r   r0   )r1   rC   r   r   r   delete_existingrS   to_rep_with	is_global
registeredr   r   pending_actionsprefetched_commandsdesyncedry   filtered_no_actionfiltered_deletedrj   r   rz   r   r   s   ` `                  @@r5   register_commandsz)ApplicationCommandMixin.register_commands  s    > 88H.67sDIIcN77 ,'j +, $	
6"?JKG		BB))..>>))..>>		::	$ C QG 		AA))..==))..==		99	$ C !#'		6?	6 	6 !		6* IKyy~~#04		0R0R		))1 +' 15		0Q0Q		))81 +' "77!.A 8  H   'Ix=H,#**2Aht'R{'='=i&'R%(^( #&d) G#i.*=*=C	NDWDWX=x=F*#**&,',"%d) ]h.#**&.', ]*#**&*', %'7H%GHHO'IP "&8/J"  $8/J  & S)9%:c'l%J =MMSI..0MM)*a/JJVW!4JJJ@APQA9**AhK7Q 
 (05'I!IJ)!#J- MC8}0&$I%(^%8%8%-	   !8}."))"* & #D	 #I 6 6 8),Y)<)<)1#  X(2"))"* ( #I 6 6 8),Y)<)<)1	#  )+;CM?)KLL;M@ 99>>'+/99>>+M+M IINN--, &
 ,099>>+L+L IINN--x, &
 .55cCKKM5D5'xHHJ 	5A11vYUU6]C
  )!F)GAEE&M? K( (  tWCF14D&&svv.	5 g 8V++l N R "J&& 6Hs   Z!Y1GZ!Y6AZ!Y9Z!.Y</D3Z!"Y?<=Z!9Z
Z!)Z	*5Z!Z A	Z!)Z
*A	Z!3Z
4A>Z!2Z3AZ!?Z 	Z!	Z Z!0Z1BZ!9Z!<Z!?Z!Z!Z!Z!Z!Z!Z!c           	        K   t        t        |xs g | j                  j                  xs g z               }|| j                  }||D ]	  }||_         |D cg c]  }|j
                  | }	}| j                  |	|||       d{   }
i }|rg }|D ]*  }|j
                  |j                  |j
                         , ||j                  |       t        |      D ]N  }|D cg c]  }|j
                  ||j
                  v r|  }}| j                  |||||       d{   }|||<   P |
D ]S  t        | j                  d   dj                  d            }|s1d   |_	        || j                  |j                  <   U |rb|r_|j                         D ]K  \  }}|D ]A  t        fd| j                        }|sd   |_	        || j                  |j                  <   C M yyyc c}w 7 kc c}w 7 խw)	a  |coro|

        Registers all commands that have been added through :meth:`.add_application_command`. This method cleans up all
        commands over the API and should sync them with the internal cache of commands. It attempts to register the
        commands in the most efficient way possible, unless ``force`` is set to ``True``, in which case it will always
        register all commands.

        By default, this coroutine is called inside the :func:`.on_connect` event. If you choose to override the
        :func:`.on_connect` event, then you should invoke this coroutine as well such as the following:

        .. code-block:: python

            @bot.event
            async def on_connect():
                if bot.auto_sync_commands:
                    await bot.sync_commands()
                print(f"{bot.user.name} connected.")

        .. note::
            If you remove all guild commands from a particular guild, the library may not be able to detect and update
            the commands accordingly, as it would have to individually check for each guild. To force the library to
            unregister a guild's commands, call this function with ``commands=[]`` and ``guild_ids=[guild_id]``.

        .. versionadded:: 2.0

        Parameters
        ----------
        commands: Optional[List[:class:`~.ApplicationCommand`]]
            A list of commands to register. If this is not set (None), then all commands will be registered.
        method: Literal['individual', 'bulk', 'auto']
            The method to use when registering the commands. If this is set to "individual", then each command will be
            registered individually. If this is set to "bulk", then all commands will be registered in bulk. If this is
            set to "auto", then the method will be determined automatically. Defaults to "bulk".
        force: :class:`bool`
            Registers the commands regardless of the state of the command on Discord. This uses one less API call, but
            can result in hitting rate limits more often. Defaults to False.
        guild_ids: Optional[List[:class:`int`]]
            A list of guild ids to register the commands for. If this is not set, the commands'
            :attr:`~.ApplicationCommand.guild_ids` attribute will be used.
        register_guild_commands: :class:`bool`
            Whether to register guild commands. Defaults to True.
        check_guilds: Optional[List[:class:`int`]]
            A list of guilds ids to check for commands to unregister, since the bot would otherwise have to check all
            guilds. Unlike ``guild_ids``, this does not alter the commands' :attr:`~.ApplicationCommand.guild_ids`
            attribute, instead it adds the guild ids to a list of guilds to sync commands for. If
            ``register_guild_commands`` is set to False, then this parameter is ignored.
        delete_existing: :class:`bool`
            Whether to delete existing commands that are not in the list of commands to register. Defaults to True.
        N)r   r   r   )r   r   r   r   r_   rc   )r_   rL   rc   rQ   c                    | j                   d   k(  xrS | j                  j                  d      k(  xr3 | j                  d uxr# j                  d      x}xr || j                  v S )Nr_   rc   r   )r_   rc   r$   rL   )rS   r   rz   s     r5   r   z7ApplicationCommandMixin.sync_commands.<locals>.<lambda>  sl    CHH&	$9 %6HHf5%6MM5%6 *+z)::X%6 %5	 r6   )rE   setr?   rK   r;   rL   r   extendr$   rQ   r0   rx   r#   )r1   rC   r   r   rL   register_guild_commandscheck_guildsr   rS   global_commandsr   registered_guild_commandscmd_guild_idsr   guild_commandsapp_cmds
guild_cmdsrz   s                    @r5   sync_commandsz%ApplicationCommandMixin.sync_commands  sf    x C!3		8N8N8TRT UVW88H  * )* +3L3cmm6K3LL$($:$:F% %; %
 
 WY!"')M 8==,!((78 '$$\2. ?  ("}}0X5N " "
 "&!7!7"%!$3 "8 "  7?)(3? % 		9A11vYUU6]	C 458**3662		9 #'@(A(G(G(I =$*# =A6
 99C  tWCF9<D..svv6== (A"Q M
"
sP   AG>G/+G//G>	G4
G>&AG>(#G7G>&G<'=G>%BG>7G>c                X  K   || j                   j                  }|j                  t        j                  t        j
                  fvryd}	 |j                  r| j                  |j                  d      }|j                  t        j
                  u r| j                   j%                  d||      S | j'                  |       d{   }|r||_        | j+                  |       d{    y# t        $ r/ | j                  | j                  z   D ]  }|j                  s|j                  j                  d      }|rt        |      }|j                  |j                  d   k(  sU||j                  k(  s*t        |j                  t               s||j                  v s|} n |r_|j                  rS|j                  j                  d      }|| j#                          d{  7   n| j#                  |g       d{  7   | j                   j%                  d|      cY S Y w xY w7 d7 Ew)a  |coro|

        This function processes the commands that have been registered
        to the bot and other groups. Without this coroutine, none of the
        commands will be triggered.

        By default, this coroutine is called inside the :func:`.on_interaction`
        event. If you choose to override the :func:`.on_interaction` event, then
        you should invoke this coroutine as well.

        This function finds a registered command matching the interaction id from
        application commands and invokes it. If no matching command was
        found, it replies to the interaction with a default message.

        .. versionadded:: 2.0

        Parameters
        ----------
        interaction: :class:`discord.Interaction`
            The interaction to process
        auto_sync: Optional[:class:`bool`]
            Whether to automatically sync and unregister the command if it is not found in the internal cache. This will
            invoke the :meth:`~.Bot.sync_commands` method on the context of the command, either globally or per-guild,
            based on the type of the command, respectively. Defaults to :attr:`.Bot.auto_sync_commands`.
        NrQ   r   r_   )r   unknown_application_command!application_command_auto_complete)r?   auto_sync_commandsrc   r   application_commandauto_completerj   r0   KeyErrorr>   r;   r$   r   r_   rL   rH   rE   r   dispatchget_application_contextr   invoke_application_command)r1   interaction	auto_syncr   rS   r   ctxs          r5   process_application_commandsz4ApplicationCommandMixin.process_application_commands  s    8 		44I//))$
 
 -1	V44[5E5Ed5KL2 <<<99%%3['  00==!CK--c222A  	V0043T3TT V##*//33J?H#&x=xx;#3#3F#;; CMM1&s}}d; (CMM 9 #&V !1!1*//33J?H'"00222"00xj0IIIyy))*GUU 	V: > 	3s{   AH*(C( 3AH* H$!H*"H'#H*(2H!AH! )H!
H!AH!GH!9G<:!H!H* H!!H*'H*c                B   K   d fd} j                   j                  j                   |             }	  j                   j                  dfdd       d {    |j	                         s|j                          y y 7 &# t        j                  $ r Y y w xY ww)Nc                    K   j                         d {   } | _         j                  |        d {   S 7 %7 wr,   )get_autocomplete_contextr   invoke_autocomplete_callback)r   r   r   r1   s    r5   callbackzNApplicationCommandMixin.on_application_command_auto_complete.<locals>.callbackl  sA     55kBBC!CK===cBBB CBs   A> AA A Ar   c                    |k(  S r,   r   )rz   r   r   s     r5   r   zNApplicationCommandMixin.on_application_command_auto_complete.<locals>.<lambda>u  s    1< r6      )r~   timeoutr   None)r?   loopcreate_taskwait_fordonecancelasyncioTimeoutError)r1   r   r   r   autocomplete_tasks   ```  r5   $on_application_command_auto_completez<ApplicationCommandMixin.on_application_command_auto_completei  s     	C
 !IINN66xzB
	+))$$3/ %    %))+!((* ,
 ## 		s:   3B$B BB ""BB BBBBc                2     | j                   ddt        i|S )a  A shortcut decorator that invokes :func:`command` and adds it to
        the internal command list via :meth:`add_application_command`.
        This shortcut is made specifically for :class:`.SlashCommand`.

        .. versionadded:: 2.0

        Returns
        -------
        Callable[..., :class:`SlashCommand`]
            A decorator that converts the provided method into a :class:`.SlashCommand`, adds it to the bot,
            then returns it.
        clsr   )r   r   r1   r3   s     r5   slash_commandz%ApplicationCommandMixin.slash_command~  s     (t''CLCFCCr6   c                2     | j                   ddt        i|S )a  A shortcut decorator that invokes :func:`command` and adds it to
        the internal command list via :meth:`add_application_command`.
        This shortcut is made specifically for :class:`.UserCommand`.

        .. versionadded:: 2.0

        Returns
        -------
        Callable[..., :class:`UserCommand`]
            A decorator that converts the provided method into a :class:`.UserCommand`, adds it to the bot,
            then returns it.
        r   r   )r   r   r   s     r5   user_commandz$ApplicationCommandMixin.user_command  s     (t''BKB6BBr6   c                2     | j                   ddt        i|S )a  A shortcut decorator that invokes :func:`command` and adds it to
        the internal command list via :meth:`add_application_command`.
        This shortcut is made specifically for :class:`.MessageCommand`.

        .. versionadded:: 2.0

        Returns
        -------
        Callable[..., :class:`MessageCommand`]
            A decorator that converts the provided method into a :class:`.MessageCommand`, adds it to the bot,
            then returns it.
        r   r   )r   r   r   s     r5   message_commandz'ApplicationCommandMixin.message_command  s     (t''ENEfEEr6   c                     d fd}|S )a  A shortcut decorator that invokes :func:`command` and adds it to
        the internal command list via :meth:`~.Bot.add_application_command`.

        .. versionadded:: 2.0

        Returns
        -------
        Callable[..., :class:`ApplicationCommand`]
            A decorator that converts the provided method into an :class:`.ApplicationCommand`, adds it to the bot,
            then returns it.
        c                L     t        di |       }j                  |       |S )Nr   )r   rT   )funcresultr3   r1   s     r5   	decoratorz>ApplicationCommandMixin.application_command.<locals>.decorator  s*    &W&v&t,F((0Mr6   )r   r   r   )r1   r3   r
  s   `` r5   r   z+ApplicationCommandMixin.application_command  s    	
 r6   c                &     | j                   di |S )a  An alias for :meth:`application_command`.

        .. note::

            This decorator is overridden by :class:`discord.ext.commands.Bot`.

        .. versionadded:: 2.0

        Returns
        -------
        Callable[..., :class:`ApplicationCommand`]
            A decorator that converts the provided method into an :class:`.ApplicationCommand`, adds it to the bot,
            then returns it.
        r   )r   r   s     r5   r   zApplicationCommandMixin.command  s     (t''1&11r6   c                P    |xs d}t        |||fi |}| j                  |       |S )aB  A shortcut method that creates a slash command group with no subcommands and adds it to the internal
        command list via :meth:`add_application_command`.

        .. versionadded:: 2.0

        Parameters
        ----------
        name: :class:`str`
            The name of the group to create.
        description: Optional[:class:`str`]
            The description of the group to create.
        guild_ids: Optional[List[:class:`int`]]
            A list of the IDs of each guild this group should be added to, making it a guild command.
            This will be a global command if ``None`` is passed.
        kwargs:
            Any additional keyword arguments to pass to :class:`.SlashCommandGroup`.

        Returns
        -------
        SlashCommandGroup
            The slash command group that was created.
        zNo description provided.)r   rT   )r1   r_   rm   rL   r3   groups         r5   create_groupz$ApplicationCommandMixin.create_group  s5    : "?%?!$YI&I$$U+r6   c                      d fd}|S )aj  A shortcut decorator that initializes the provided subclass of :class:`.SlashCommandGroup`
        and adds it to the internal command list via :meth:`add_application_command`.

        .. versionadded:: 2.0

        Parameters
        ----------
        name: Optional[:class:`str`]
            The name of the group to create. This will resolve to the name of the decorated class if ``None`` is passed.
        description: Optional[:class:`str`]
            The description of the group to create.
        guild_ids: Optional[List[:class:`int`]]
            A list of the IDs of each guild this group should be added to, making it a guild command.
            This will be a global command if ``None`` is passed.

        Returns
        -------
        Callable[[Type[SlashCommandGroup]], SlashCommandGroup]
            The slash command group that was created.
        c                     | xs | j                   | j                  4xs2 t        j                  | j                        j	                         d   nd      }j                  |       |S )Nr   zNo description providedr   )__name____doc__inspectcleandoc
splitlinesrT   )r   r  rm   rL   r_   r1   s     r5   innerz,ApplicationCommandMixin.group.<locals>.inner  sg    $ {{.  P7#3#3CKK#@#K#K#Ma#P2#E ((/Lr6   )r   ztype[SlashCommandGroup]r   r   r   )r1   r_   rm   rL   r  s   ```` r5   r  zApplicationCommandMixin.group  s    6	 	 r6   c              #     K   | j                   D ]/  }t        |t              r |j                         E d{    | 1 y7 w)zAn iterator that recursively walks through all application commands and subcommands.

        Yields
        ------
        :class:`.ApplicationCommand`
            An application command from the internal list of application commands.
        N)r>   rH   r   walk_commandsrX   s     r5   walk_application_commandsz1ApplicationCommandMixin.walk_application_commands  sD      00 	G'#450700222M	2s   4AAAc                   K    || |      S w)aH  |coro|

        Returns the invocation context from the interaction.

        This is a more low-level counter-part for :meth:`.process_application_commands`
        to allow users more fine-grained control over the processing.

        Parameters
        -----------
        interaction: :class:`discord.Interaction`
            The interaction to get the invocation context from.
        cls
            The factory class that will be used to create the context.
            By default, this is :class:`.ApplicationContext`. Should a custom
            class be provided, it must be similar enough to
            :class:`.ApplicationContext`\'s interface.

        Returns
        --------
        :class:`.ApplicationContext`
            The invocation context. The type of this can change via the
            ``cls`` parameter.
        r   r1   r   r   s      r5   r   z/ApplicationCommandMixin.get_application_context+       4 4%%   
c                   K    || |      S w)aO  |coro|

        Returns the autocomplete context from the interaction.

        This is a more low-level counter-part for :meth:`.process_application_commands`
        to allow users more fine-grained control over the processing.

        Parameters
        -----------
        interaction: :class:`discord.Interaction`
            The interaction to get the invocation context from.
        cls
            The factory class that will be used to create the context.
            By default, this is :class:`.AutocompleteContext`. Should a custom
            class be provided, it must be similar enough to
            :class:`.AutocompleteContext`\'s interface.

        Returns
        --------
        :class:`.AutocompleteContext`
            The autocomplete context. The type of this can change via the
            ``cls`` parameter.
        r   r  s      r5   r   z0ApplicationCommandMixin.get_autocomplete_contextG  r  r  c                  K   | j                   j                  d|       	 | j                   j                  |d       d{   r$|j                  j	                  |       d{    nt        d      	 | j                   j                  d|       y7 Q7 0# t        $ r/}|j                  j                  ||       d{  7   Y d}~yd}~ww xY ww)a  |coro|

        Invokes the application command given under the invocation
        context and handles all the internal event dispatch mechanisms.

        Parameters
        ----------
        ctx: :class:`.ApplicationCommand`
            The invocation context to invoke.
        r   T	call_onceNz'The global check once functions failed.application_command_completion)r?   r   can_runr   invoker   r   dispatch_error)r1   r   excs      r5   r   z2ApplicationCommandMixin.invoke_application_commandc  s      			0#6	FYY&&sd&;;;kk((---"#LMM . II?E <-   	7++,,S#666	7s^   C B  B"B #B$B 5CB B 	CC	>C?C	C	CCc                     y r,   r   r8   s    r5   r?   zApplicationCommandMixin._boty  s    ,/r6   r   )r   zlist[ApplicationCommand | Any])r   zlist[ApplicationCommand])r   r   r   r   )r   r   r   ApplicationCommand | None)r_   r   rL   list[int] | Nonerc   ztype[ApplicationCommand]r   r(  )NN)r   r   r   z,list[interactions.ApplicationCommand] | Noner   zlist[dict[str, Any]])TN)r   r   r   r   rL   r)  r   r   )NNr   FT)rC   list[ApplicationCommand] | Noner   r   r   %Literal['individual', 'bulk', 'auto']r   r   r   r   r   z%list[interactions.ApplicationCommand])rC   r*  r   r+  r   r   rL   r)  r   r   r   r)  r   r   r   r   r,   )r   r   r   zbool | Noner   r   )r   r   r   r   r   r   )r_   r   rm   
str | NonerL   r)  r   r   )NNN)r_   r,  rm   r,  rL   r)  r   z6Callable[[type[SlashCommandGroup]], SlashCommandGroup])r   z)Generator[ApplicationCommand, None, None])r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   )r   zBot | AutoShardedBot)&r  
__module____qualname__r  r.   propertyr9   r;   rC   r>   rT   rY   r\   r   r[   r   r   r   r   r   r   r  r  r  r   r   r  r  slash_groupr  r   r   r   r   r   r   r?   __classcell__r4   s   @r5   r'   r'   G   s-   
(
 * * 2 2   9 9;B)	"4 	, 	, '+);	.. $. '	.
 
#.d  $CGdd Ad 
	dR &*	"#" " $	"
 
"@ 59#8> $u1u u 6	u
 u u 
/ur 598>&*(,)+ $|=1|= 6|= 	|=
 $|= "&|= '|= |= 
|=~ BFI3&I33>I3	I3V+&+1C+	+*DCF(2( #'&*	      $	  
 H  "&&*	((  ( $	(
 
@(T K 4F&&&-0&	&: 4G&&&-0&	&8F, /  /r6   r'   c                       e Zd ZdZd fd	Zd Zd Z	 	 	 	 	 	 ddZd ZddddZ	dddd	Z
d
 Zdd	 	 	 	 	 ddZd Zd ZddZ xZS )BotBaseFc                ,   t        |   |i | i | _        i | _        g | _        g | _        d | _        d | _        |rt        j                  |      nd| _
        |j                  d      | _        |j                  dt                     | _        |j                  dd      | _        |j!                  dd       | _        |j!                  dt$        j&                  t$        j(                  t$        j*                  h      | _        |j!                  dt.        j0                  h      | _        | j                  r| j                  rt5        d	      | j                  rPt7        | j                  t8        j:                  j<                        s"t5        d
| j                  j>                        t7        | j,                  t8        j:                  j<                        s"t5        d| j,                  j>                        t7        | j2                  t8        j:                  j<                        s"t5        d| j2                  j>                        t        | j,                        | _        t        | j2                        | _        g | _        g | _        d | _        d | _        y )N owner_id	owner_idsr   TrK   rM   rO   z$Both owner_id and owner_ids are set.z#owner_ids must be a collection not z2default_command_contexts must be a collection not z;default_command_integration_types must be a collection not ) r-   r.   _BotBase__cogs_BotBase__extensions_checks_check_once_before_invoke_after_invoker  r  rm   r$   r7  r   r8  r   rV   rK   r   guildbot_dmprivate_channelrM   r   guild_installrO   rJ   rH   r   abc
Collectionr4   )r1   rm   r2   rg   r4   s       r5   r.   zBotBase.__init__  s5   $*'*"!<G7++K8RJ/ [#%8")++.BD"I#KK=(/&&,,&--&66)
% 29/--2
. ==T^^BCC>>*NNKOO66#
 5dnn6N6N5QR  $779S9STDTEbEbElElDop  22KOO4N4N
 MdNtNtN~N~  NB  C  ),D,I,I(J%14222
. "!r6   c                Z   K   | j                   r| j                          d {    y y 7 wr,   )r   r   r8   s    r5   
on_connectzBotBase.on_connect  s)     ""$$&&& #&s    +)+c                B   K   | j                  |       d {    y 7 wr,   )r   )r1   r   s     r5   on_interactionzBotBase.on_interaction  s     //<<<s   c                  K   | j                   j                  dd      ry|j                  }|r |j                         ry|j                  }|r|j                         ryt        d|j                   dt        j                         t        j                  t        |      ||j                  t        j                         yw)a!  |coro|

        The default command error handler provided by the bot.

        By default, this prints to :data:`sys.stderr` however it could be
        overridden to have a different implementation.

        This only fires if you do not specify any listeners for command error.
        on_application_command_errorNzIgnoring exception in command :)file)_event_handlersr$   r   has_error_handlercogprintsysstderr	tracebackprint_exceptionrc   __traceback__)r1   context	exceptionr   rO  s        r5   rJ  z$BotBase.on_application_command_error  s      ##$BDI//0w002kk3((*.w.?qA

S!!OY	(?(?cjj	
s   CCc                (    | j                  |       |S )a  A decorator that adds a global check to the bot. A global check is similar to a :func:`.check` that is
        applied on a per-command basis except it is run before any command checks have been verified and applies to
        every command the bot has.

        .. note::

           This function can either be a regular function or a coroutine. Similar to a command :func:`.check`, this
           takes a single parameter of type :class:`.Context` and can only raise exceptions inherited from
           :exc:`.ApplicationCommandError`.

        Example
        -------
        .. code-block:: python3

            @bot.check
            def check_commands(ctx):
                return ctx.command.qualified_name in allowed_commands
        	add_checkr1   r  s     r5   r~   zBotBase.check  s    ( 	tr6   r   c               v    |r| j                   j                  |       y| j                  j                  |       y)ac  Adds a global check to the bot. This is the non-decorator interface to :meth:`.check` and
        :meth:`.check_once`.

        Parameters
        ----------
        func
            The function that was used as a global check.
        call_once: :class:`bool`
            If the function should only be called once per :meth:`.Bot.invoke` call.
        N)r<  rR   r;  )r1   r  r!  s      r5   rZ  zBotBase.add_check  s-     ##D)LL%r6   c               z    |r| j                   n| j                  }	 |j                  |       y# t        $ r Y yw xY w)a  Removes a global check from the bot.
        This function is idempotent and will not raise an exception
        if the function is not in the global checks.

        Parameters
        ----------
        func
            The function to remove from the global checks.
        call_once: :class:`bool`
            If the function was added with ``call_once=True`` in
            the :meth:`.Bot.add_check` call or using :meth:`.check_once`.
        N)r<  r;  rW   r   )r1   r  r!  checkss       r5   remove_checkzBotBase.remove_check	  s:     &/!!DLL	MM$ 		s   . 	::c                ,    | j                  |d       |S )aM  A decorator that adds a "call once" global check to the bot. Unlike regular global checks, this one is called
        only once per :meth:`.Bot.invoke` call. Regular global checks are called whenever a command is called or
        :meth:`.Command.can_run` is called. This type of check bypasses that and ensures that it's called only once,
        even inside the default help command.

        .. note::

           When using this function the :class:`.Context` sent to a group subcommand may only parse the parent command
           and not the subcommands due to it being invoked once per :meth:`.Bot.invoke` call.

        .. note::

           This function can either be a regular function or a coroutine. Similar to a command :func:`.check`,
           this takes a single parameter of type :class:`.Context` and can only raise exceptions inherited from
           :exc:`.ApplicationCommandError`.

        Example
        -------
        .. code-block:: python3

            @bot.check_once
            def whitelist(ctx):
                return ctx.message.author.id in my_whitelist
        Tr   rY  r[  s     r5   
check_oncezBotBase.check_once  s    2 	tt,r6   c                  K   |r| j                   n| j                  }|syt        fd|D               d {   S 7 w)NTc              3  .   K   | ]  } |        y wr,   r   )ri   fr   s     r5   rl   z"BotBase.can_run.<locals>.<genexpr>B  s     4!qv4s   )r<  r;  r"   )r1   r   r!  rj   s    `  r5   r#  zBotBase.can_run9  s;      $-t$,, 4t44444s   5?=?c                T    t        j                  |      st        d      || _        |S )as  A decorator that registers a coroutine as a pre-invoke hook.
        A pre-invoke hook is called directly before the command is
        called. This makes it a useful function to set up database
        connections or any type of set up required.
        This pre-invoke hook takes a sole parameter, a :class:`.Context`.

        .. note::

            The :meth:`~.Bot.before_invoke` and :meth:`~.Bot.after_invoke` hooks are
            only called if all checks and argument parsing procedures pass
            without error. If any check or argument parsing procedures fail
            then the hooks are not called.

        Parameters
        ----------
        coro: :ref:`coroutine <coroutine>`
            The coroutine to register as the pre-invoke hook.

        Raises
        ------
        TypeError
            The coroutine passed is not actually a coroutine.
        z(The pre-invoke hook must be a coroutine.)r   iscoroutinefunctionrJ   r=  r1   coros     r5   before_invokezBotBase.before_invokeD  s+    0 **40FGG"r6   c                T    t        j                  |      st        d      || _        |S )a  A decorator that registers a coroutine as a post-invoke hook.
        A post-invoke hook is called directly after the command is
        called. This makes it a useful function to clean-up database
        connections or any type of clean up required.
        This post-invoke hook takes a sole parameter, a :class:`.Context`.

        .. note::

            Similar to :meth:`~.Bot.before_invoke`\, this is not called unless
            checks and argument parsing procedures succeed. This hook is,
            however, **always** called regardless of the internal command
            callback raising an error (i.e. :exc:`.CommandInvokeError`\).
            This makes it ideal for clean-up scenarios.

        Parameters
        -----------
        coro: :ref:`coroutine <coroutine>`
            The coroutine to register as the post-invoke hook.

        Raises
        -------
        TypeError
            The coroutine passed is not actually a coroutine.

        z)The post-invoke hook must be a coroutine.)r   rf  rJ   r>  rg  s     r5   after_invokezBotBase.after_invokeb  s+    4 **40GHH!r6   c                  K   | j                   r|j                  | j                   k(  S | j                  r|j                  | j                  v S | j                          d{   }|j                  rC|j                  j
                  D ch c]  }|j                   c}x| _        }|j                  |v S |j                  j                  x| _         }|j                  |k(  S 7 c c}w w)a]  |coro|

        Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
        this bot.

        If an :attr:`owner_id` is not set, it is fetched automatically
        through the use of :meth:`~.Bot.application_info`.

        .. versionchanged:: 1.3
            The function also checks if the application is team-owned if
            :attr:`owner_ids` is not set.

        Parameters
        ----------
        user: :class:`.abc.User`
            The user to check for.

        Returns
        -------
        :class:`bool`
            Whether the user is the owner.
        N)r7  rQ   r8  application_infoteammembersowner)r1   r   appmidsr7  s         r5   is_ownerzBotBase.is_owner  s     0 ==77dmm++^^77dnn,,--//Cxx69hh6F6F'G'GGww#~%+.99<<7ww(** 0'Gs%   AC&C (C&C!AC&!C&r,   )rV  r   rW  r   r   r   )r!  r   r   r   )r   r   r!  r   r   r   )r   r    r   r   )r  r-  r.  r@   r.   rF  rH  rJ  r~   rZ  r_  ra  r#  ri  rk  rt  r1  r2  s   @r5   r4  r4  ~  s    "'9"v'=
)
6F
	
<. 49 &" 7< (: =B	5%	559	5		5<@#+r6   r4  c                  "    e Zd ZdZedd       Zy)r(   a  Represents a discord bot.

    This class is a subclass of :class:`discord.Client` and as a result
    anything that you can do with a :class:`discord.Client` you can do with
    this bot.

    This class also subclasses ``ApplicationCommandMixin`` to provide the functionality
    to manage commands.

    .. versionadded:: 2.0

    Attributes
    ----------
    description: :class:`str`
        The content prefixed into the default help message.
    owner_id: Optional[:class:`int`]
        The user ID that owns the bot. If this is not set and is then queried via
        :meth:`.is_owner` then it is fetched automatically using
        :meth:`~.Bot.application_info`.
    owner_ids: Optional[Collection[:class:`int`]]
        The user IDs that owns the bot. This is similar to :attr:`owner_id`.
        If this is not set and the application is team based, then it is
        fetched automatically using :meth:`~.Bot.application_info`.
        For performance reasons it is recommended to use a :class:`set`
        for the collection. You cannot set both ``owner_id`` and ``owner_ids``.

        .. versionadded:: 1.3
    debug_guilds: Optional[List[:class:`int`]]
        Guild IDs of guilds to use for testing commands.
        The bot will not create any global commands if debug guild IDs are passed.

        .. versionadded:: 2.0
    auto_sync_commands: :class:`bool`
        Whether to automatically sync slash commands. This will call :meth:`~.Bot.sync_commands` in :func:`discord.on_connect`, and in
        :attr:`.process_application_commands` if the command is not found. Defaults to ``True``.

        .. versionadded:: 2.0
    default_command_contexts: Collection[:class:`InteractionContextType`]
        The default context types that the bot will use for commands.
        Defaults to a set containing :attr:`InteractionContextType.guild`, :attr:`InteractionContextType.bot_dm`, and
        :attr:`InteractionContextType.private_channel`.

        .. versionadded:: 2.6
    default_command_integration_types: Collection[:class:`IntegrationType`]]
        The default integration types that the bot will use for commands.
        Defaults to a set containing :attr:`IntegrationType.guild_install`.

        .. versionadded:: 2.6
    c                    | S r,   r   r8   s    r5   r?   zBot._bot      r6   N)r   r(   r  r-  r.  r  r/  r?   r   r6   r5   r(   r(     s    0d  r6   r(   c                  "    e Zd ZdZedd       Zy)r)   zThis is similar to :class:`.Bot` except that it is inherited from
    :class:`discord.AutoShardedClient` instead.

    .. versionadded:: 2.0
    c                    | S r,   r   r8   s    r5   r?   zAutoShardedBot._bot  rw  r6   N)r   r)   rx  r   r6   r5   r)   r)     s      r6   r)   )@r  
__future__r   r   r   collections.abcr   r  loggingrQ  rS  rC  r   r   typingr   r   r   r	   r
   r   r   clientr   rO  r   rC   r   r   r   r   r   r   r   r   enumsr   r   r   errorsr   r   r   r   shardr   typesr   r    utilsr!   r"   r#   r$   CoroFuncr%   __all__	getLoggerr  r   r'   r4  r(   r)   r   r6   r5   <module>r     s   2 #       
  # Q Q Q  	 	 	 L K 2 % $   0 0C3S=112e8$ w"t0c t0n!g+%x g+T	5'6 5p	W/ 	r6   