Pycord-Development/pycord

Subgroup having MISSING cog attribute

Dasupergrasskakjd opened this issue · 0 comments

Summary

The bot raises Attribute error when you invoke a subcommand under a subgroup under a command group

Reproduction Steps

  1. Create a command group
  2. Create a subgroup under it
  3. Create a command under it
  4. Invoke the command

Minimal Reproducible Code

group = bot.create_group("test1")
subgroup = group.create_subgroup("test2")

@subgroup.command()
async def test3(ctx):
   ...

Expected Results

Run the command

Actual Results

Raises an error

Traceback (most recent call last):
  File "d:\Personal\Documents\GitHub\Grass-bot-rewrite\.venv\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "d:\Personal\Documents\GitHub\Grass-bot-rewrite\.venv\Lib\site-packages\discord\commands\core.py", line 1365, in _invoke
    await command.invoke(ctx)
  File "d:\Personal\Documents\GitHub\Grass-bot-rewrite\.venv\Lib\site-packages\discord\commands\core.py", line 378, in invoke
    await self.prepare(ctx)
  File "d:\Personal\Documents\GitHub\Grass-bot-rewrite\.venv\Lib\site-packages\discord\commands\core.py", line 299, in prepare
    if not await self.can_run(ctx):
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\Personal\Documents\GitHub\Grass-bot-rewrite\.venv\Lib\site-packages\discord\commands\core.py", line 396, in can_run
    local_check = cog._get_overridden_method(cog.cog_check)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '_MissingSentinel' object has no attribute '_get_overridden_method'

Intents

All

System Information

  • Python v3.11.5-final
  • py-cord v2.4.1-final
  • aiohttp v3.8.6
  • system info: Windows 10 10.0.22621

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

#1594 should have fixed it but it only fixed for commands under a group but not commands under a subgroup