@@ -143,20 +143,20 @@ def remove_cog_commands(self, cog):
143
143
144
144
async def register_all_commands (self ):
145
145
"""
146
- Registers all slash commands except subcommands to Discord API.\n
146
+ Registers all slash commands to Discord API.\n
147
147
If ``auto_register`` is ``True``, then this will be automatically called.
148
148
"""
149
149
await self ._discord .wait_until_ready () # In case commands are still not registered to SlashCommand.
150
150
self .logger .info ("Registering commands..." )
151
151
for x in self .commands .keys ():
152
152
selected = self .commands [x ]
153
- if selected .has_subcommands and hasattr ( selected , "invoke" ) :
153
+ if selected .has_subcommands and selected . func :
154
154
# Registering both subcommand and command with same base name / name
155
- # will result in only one type of command being registered,
156
- # so we will only register subcommands.
157
- self .logger .warning (f"Detected command name with same subcommand base name! Skipping registering this command: { x } " )
158
- continue
159
- if selected .has_subcommands and not hasattr ( selected , "invoke" ) :
155
+ # will result in only subcommand being registered,
156
+ # so we will warn this at registering subcommands.
157
+ self .logger .warning (f"Detected command name with same subcommand base name! "
158
+ f"This command will only have subcommand: { x } " )
159
+ if selected .has_subcommands :
160
160
tgt = self .subcommands [x ]
161
161
options = []
162
162
for y in tgt .keys ():
@@ -171,7 +171,7 @@ async def register_all_commands(self):
171
171
options .append (_dict )
172
172
else :
173
173
base_dict = {
174
- "name" : sub . subcommand_group ,
174
+ "name" : y ,
175
175
"description" : "No Description." ,
176
176
"type" : 2 ,
177
177
"options" : []
@@ -344,7 +344,7 @@ def add_subcommand(self,
344
344
name = name .lower ()
345
345
_cmd = {
346
346
"func" : None ,
347
- "description" : "No description." ,
347
+ "description" : base_desc ,
348
348
"auto_convert" : {},
349
349
"guild_ids" : guild_ids ,
350
350
"api_options" : [],
@@ -517,7 +517,7 @@ async def _group_kick_user(ctx, user):
517
517
auto_convert [x ["name" ]] = x ["type" ]
518
518
519
519
def wrapper (cmd ):
520
- self .add_subcommand (cmd , base , subcommand_group , sub_group_desc , name , description , auto_convert , guild_ids , options )
520
+ self .add_subcommand (cmd , base , subcommand_group , name , description , base_desc , sub_group_desc , auto_convert , guild_ids , options )
521
521
return cmd
522
522
523
523
return wrapper
0 commit comments