@@ -17,31 +17,31 @@ class SlashCommand:
1717
1818 :param client: discord.py Client or Bot instance.
1919 :type client: Union[discord.Client, discord.ext.commands.Bot]
20- :param auto_register : Whether to register commands automatically. Default `False`.
21- :type auto_register : bool
20+ :param sync_commands : Whether to sync commands automatically. Default `False`.
21+ :type sync_commands : bool
2222 :param override_type: Whether to override checking type of the client and try register event.
2323 :type override_type: bool
2424
2525 :ivar _discord: Discord client of this client.
2626 :ivar commands: Dictionary of the registered commands via :func:`.slash` decorator.
2727 :ivar req: :class:`.http.SlashCommandRequest` of this client.
2828 :ivar logger: Logger of this client.
29- :ivar auto_register : Whether to register commands automatically.
29+ :ivar sync_commands : Whether to sync commands automatically.
3030 :ivar has_listener: Whether discord client has listener add function.
3131 """
3232
3333 def __init__ (self ,
3434 client : typing .Union [discord .Client , commands .Bot ],
35- auto_register : bool = False ,
35+ sync_commands : bool = False ,
3636 override_type : bool = False ):
3737 self ._discord = client
3838 self .commands = {}
3939 self .subcommands = {}
4040 self .logger = logging .getLogger ("discord_slash" )
4141 self .req = http .SlashCommandRequest (self .logger , self ._discord )
42- self .auto_register = auto_register
42+ self .sync_commands = sync_commands
4343
44- if self .auto_register :
44+ if self .sync_commands :
4545 self ._discord .loop .create_task (self .sync_all_commands ())
4646
4747 if not isinstance (client , commands .Bot ) and not isinstance (client , commands .AutoShardedBot ) and not override_type :
@@ -188,7 +188,7 @@ async def to_dict(self):
188188 Commands are in the format specified by discord `here <https://discord.com/developers/docs/interactions/slash-commands#applicationcommand>`_
189189 """
190190 await self ._discord .wait_until_ready () # In case commands are still not registered to SlashCommand.
191- commands = {
191+ cmds = {
192192 "global" : [],
193193 "guild" : {}
194194 }
@@ -242,13 +242,13 @@ async def to_dict(self):
242242 if selected .allowed_guild_ids :
243243 for y in selected .allowed_guild_ids :
244244 try :
245- commands ["guild" ][y ].append (command_dict )
245+ cmds ["guild" ][y ].append (command_dict )
246246 except KeyError :
247- commands ["guild" ][y ] = [command_dict ]
247+ cmds ["guild" ][y ] = [command_dict ]
248248 else :
249- commands ["global" ].append (command_dict )
249+ cmds ["global" ].append (command_dict )
250250
251- return commands
251+ return cmds
252252
253253 async def sync_all_commands (self , delete_from_unused_guilds = False ):
254254 """
@@ -260,7 +260,7 @@ async def sync_all_commands(self, delete_from_unused_guilds=False):
260260 :param delete_from_unused_guilds: If the bot should make a request to set no commands for guilds that haven't got any commands registered in :class:``SlashCommand``
261261 """
262262 cmds = await self .to_dict ()
263- self .logger .info ("Registering commands..." )
263+ self .logger .info ("Syncing commands..." )
264264 other_guilds = [x .id for x in self ._discord .guilds if x .id not in cmds ["guild" ]]
265265 # This is an extremly bad way to do this, because slash cmds can be in guilds the bot isn't in
266266 # But it's the only way until discord makes an endpoint to request all the guild with cmds registered.
@@ -274,7 +274,7 @@ async def sync_all_commands(self, delete_from_unused_guilds=False):
274274 with suppress (discord .Forbidden ):
275275 await self .req .put_slash_commands (slash_commands = [], guild_id = x )
276276
277- self .logger .info ("Completed registering all commands!" )
277+ self .logger .info ("Completed syncing all commands!" )
278278
279279 def add_slash_command (self ,
280280 cmd ,
0 commit comments