@@ -72,6 +72,8 @@ def add_slash_command(self,
72
72
:param has_subcommands: Whether it has subcommand. Default ``False``.
73
73
:type has_subcommands: bool
74
74
"""
75
+ name = cmd .__name__ if not name else name
76
+ name = name .lower ()
75
77
_cmd = {
76
78
"func" : cmd ,
77
79
"description" : description ,
@@ -80,8 +82,8 @@ def add_slash_command(self,
80
82
"api_options" : options ,
81
83
"has_subcommands" : has_subcommands
82
84
}
83
- self .commands [cmd . __name__ if not name else name ] = _cmd
84
- self .logger .debug (f"Added command `{ cmd . __name__ if not name else name } `" )
85
+ self .commands [name ] = _cmd
86
+ self .logger .debug (f"Added command `{ name } `" )
85
87
86
88
def add_subcommand (self ,
87
89
cmd ,
@@ -109,7 +111,10 @@ def add_subcommand(self,
109
111
:param guild_ids: List of guild ID of where the command will be used. Default ``None``, which will be global command.
110
112
:type guild_ids: List[int]
111
113
"""
114
+ base = base .lower ()
115
+ subcommand_group = subcommand_group .lower () if subcommand_group else subcommand_group
112
116
name = cmd .__name__ if not name else name
117
+ name = name .lower ()
113
118
_cmd = {
114
119
"guild_ids" : guild_ids ,
115
120
"has_subcommands" : True
@@ -202,7 +207,7 @@ async def _pick(ctx, choice1, choice2): # Command with 1 or more args.
202
207
auto_convert [x ["name" ]] = x ["type" ]
203
208
204
209
def wrapper (cmd ):
205
- self .add_slash_command (cmd , name . lower () , description , auto_convert , guild_ids , options )
210
+ self .add_slash_command (cmd , name , description , auto_convert , guild_ids , options )
206
211
return cmd
207
212
return wrapper
208
213
@@ -254,7 +259,7 @@ async def _group_kick_user(ctx, user):
254
259
"""
255
260
256
261
def wrapper (cmd ):
257
- self .add_subcommand (cmd , base . lower () , subcommand_group . lower () , name . lower () , description , auto_convert , guild_ids )
262
+ self .add_subcommand (cmd , base , subcommand_group , name , description , auto_convert , guild_ids )
258
263
return cmd
259
264
return wrapper
260
265
@@ -358,7 +363,7 @@ async def handle_subcommand(self, ctx: model.SlashContext, data: dict):
358
363
sub_name = sub ["name" ]
359
364
sub_opts = sub ["options" ] if "options" in sub else []
360
365
for x in sub_opts :
361
- if "options" in x .keys ():
366
+ if "options" in x .keys () or "value" not in x . keys () :
362
367
sub_group = x ["name" ]
363
368
selected = base [sub_name ][sub_group ]
364
369
args = await self .process_options (ctx .guild , x ["options" ], selected ["auto_convert" ]) \
0 commit comments