Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kwargs is not defined in SlashCommandGroup #1150

Closed
3 tasks done
Indominus-Rexian opened this issue Mar 10, 2022 · 1 comment · Fixed by #1151
Closed
3 tasks done

kwargs is not defined in SlashCommandGroup #1150

Indominus-Rexian opened this issue Mar 10, 2022 · 1 comment · Fixed by #1151
Assignees
Labels
bug Something isn't working priority: high High Priority
Milestone

Comments

@Indominus-Rexian
Copy link

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.

@Indominus-Rexian Indominus-Rexian added the unconfirmed bug A bug report that needs triaging label Mar 10, 2022
@krittick
Copy link
Contributor

@Middledot this was the bug I mentioned that got introduced in #1127. Can you please review and prioritize a fix?

@krittick krittick added bug Something isn't working and removed unconfirmed bug A bug report that needs triaging labels Mar 10, 2022
@krittick krittick added this to the v2.0 milestone Mar 10, 2022
@krittick krittick added the priority: high High Priority label Mar 10, 2022
@Dorukyum Dorukyum self-assigned this Mar 10, 2022
@Middledot Middledot mentioned this issue Mar 13, 2022
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high High Priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants