Closed
Description
Summary
The init function of SlashCommandGroup doesn't seem to have **kwargs.
Reproduction Steps
from discord.commands import SlashCommandGroup
image = SlashCommandGroup("image","Commands related to Image Generation")
Error:
File "/images_slash.py", line 20, in images_slash
image = SlashCommandGroup("image","Commands related to Image Generation")
File "venv/lib/python3.10/site-packages/discord/commands/core.py", line 905, in __init__
self.checks = kwargs.get("checks", [])
NameError: name 'kwargs' is not defined
Minimal Reproducible Code
No response
Expected Results
The bot was supposed to run, load the cog and implement the Slash command group.
Actual Results
The code threw the error:
Traceback (most recent call last):
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/venv/lib/python3.10/site-packages/discord/cog.py", line 684, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/cogs_slash/images_slash.py", line 12, in <module>
class images_slash(commands.Cog):
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/cogs_slash/images_slash.py", line 20, in images_slash
image = SlashCommandGroup("image","Commands related to Image Generation")
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/venv/lib/python3.10/site-packages/discord/commands/core.py", line 905, in __init__
self.checks = kwargs.get("checks", [])
NameError: name 'kwargs' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/bot.py", line 132, in <module>
client.load_extension(f"cogs_slash.{filename[:-3]}")
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/venv/lib/python3.10/site-packages/discord/cog.py", line 756, in load_extension
self._load_from_module_spec(spec, name)
File "/home/indo/Documents/Projects/Rexians-Pycord-Github/venv/lib/python3.10/site-packages/discord/cog.py", line 687, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs_slash.images_slash' raised an error: NameError: name 'kwargs' is not defined
Intents
All
System Information
- Python v3.10.2-final
- py-cord v2.0.0-beta
- py-cord pkg_resources: v2.0.0b5
- aiohttp v3.7.4.post0
- system info: Linux 5.15.25-1-MANJARO Update README.rst #1 SMP PREEMPT Wed Feb 23 14:44:03 UTC 2022
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
Pretty sure adding the **kwargs
in the class SlashCommandGroup
(line 887) will fix this. I tried and it actually worked.