Skip to content

Commit dd0bc5b

Browse files
committed
Fixed name issue with cog_ext
1 parent 3817e04 commit dd0bc5b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

discord_slash/cog_ext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def wrapper(cmd):
5959
"api_options": options if options else [],
6060
"has_subcommands": False
6161
}
62-
return CogCommandObject(name, _cmd)
62+
return CogCommandObject(cmd.__name__ if not name else name, _cmd)
6363
return wrapper
6464

6565

@@ -109,10 +109,10 @@ async def group_say(self, ctx: SlashContext, text: str):
109109
def wrapper(cmd):
110110
_sub = {
111111
"func": cmd,
112-
"name": name,
112+
"name": cmd.__name__ if not name else name,
113113
"description": description,
114114
"auto_convert": auto_convert,
115115
"guild_ids": guild_ids,
116116
}
117-
return CogSubcommandObject(_sub, base, name, subcommand_group)
117+
return CogSubcommandObject(_sub, base, cmd.__name__ if not name else name, subcommand_group)
118118
return wrapper

discord_slash/model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class CommandObject:
185185
:ivar options: List of the option of the command. Used for `auto_register`.
186186
"""
187187
def __init__(self, name, cmd): # Let's reuse old command formatting.
188-
self.name = name
188+
self.name = name.lower()
189189
self.func = cmd["func"]
190190
self.description = cmd["description"]
191191
self.auto_convert = cmd["auto_convert"] if cmd["auto_convert"] else {}
@@ -219,9 +219,9 @@ class SubcommandObject:
219219
:ivar allowed_guild_ids: List of the allowed guild id.
220220
"""
221221
def __init__(self, sub, base, name, sub_group=None):
222-
self.base = base
223-
self.subcommand_group = sub_group
224-
self.name = name
222+
self.base = base.lower()
223+
self.subcommand_group = sub_group.lower() if sub_group else sub_group
224+
self.name = name.lower()
225225
self.func = sub["func"]
226226
self.description = sub["description"]
227227
self.auto_convert = sub["auto_convert"] if sub["auto_convert"] else {}
@@ -264,7 +264,7 @@ class CogSubcommandObject(SubcommandObject):
264264
265265
.. warning::
266266
Do not manually init this model.
267-
"""
267+
"""
268268
def __init__(self, *args):
269269
super().__init__(*args)
270270
self.cog = None # Manually set this later.

0 commit comments

Comments
 (0)