Parameter ctx isnt detected even if its being passed in for certain subcommands #5915
-
SummarySo I was making a subcommand inside a cog. But then, when I ran my code after creating it, I got this error: raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing. I think that this is a bug with dpy, not sure. Reproduction StepsSo here's my code. class Configuration(commands.Cog):
def __init__(self, client):
self.client = client
@commands.group(invoke_without_command=True)
async def plugin(self, ctx, invalid_module=None):
@plugin.command()
@commands.guild_only()
async def list(self, ctx, module_name=None): I made my subcommand inside the cog like this [I think that sructure matters] Expected ResultsI expected the command to work fine, because similar subcommands which were created earlier worked fine. Actual ResultsI got this error. Ignoring exception in command plugin list:
Traceback (most recent call last):
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 1329, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 851, in invoke
await self.prepare(ctx)
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 786, in prepare
await self._parse_arguments(ctx)
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\Iyappan\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing. IntentsDont think this applies, anyways I have members and presence intents enabled in my dev portal Checklist
System Information- Python v3.6.5-final
- discord.py v1.5.0-final
- aiohttp v3.6.2
- system info: Windows 10 10.0.17763 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This happens when you have multiple functions with the same name, for example: class Example(commands.Cog):
@commands.command()
async def bar(self, ctx):
pass
@commands.group()
async def foo(self, ctx):
pass
@foo.command()
async def bar(self, ctx):
pass |
Beta Was this translation helpful? Give feedback.
This happens when you have multiple functions with the same name, for example: