Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.81k stars 2.31k forks source link

Custom commands with Parameters not working #6145

Closed scarecr0w12 closed 1 year ago

scarecr0w12 commented 1 year ago

What Red version are you using?

3.5.1

Cog name

Customcom

Command name

+greet @scarecr0w12

What did you expect to happen?

Bot should utilize the custom command of greet which requires a Mentioned user.

When you input: +greet <mention user>

it should output: Hello, <Mentioned user>

What actually happened?

No output from discord bot, however the error is logged in the log files:

[2023-05-11 21:36:15] [ERROR] discord.client: Ignoring exception in on_message_without_command
Traceback (most recent call last):
  File "/root/redenv/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "/root/redenv/lib/python3.11/site-packages/redbot/cogs/customcom/customcom.py", line 679, in on_message_without_command
    await self.bot.invoke(ctx)
  File "/root/redenv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/root/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1015, in invoke
    await self.prepare(ctx)
  File "/root/redenv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 482, in prepare
    await self._parse_arguments(ctx)
  File "/root/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 847, in _parse_arguments
    kwargs[name] = await self.transform(ctx, param, attachments)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/redenv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 647, in transform
    converter = param.converter
                ^^^^^^^^^^^^^^^
AttributeError: 'Parameter' object has no attribute 'converter'

How can we reproduce this error?

  1. Create custom command using +cc create simple greet Hello, {0.mention:Member}!
  2. User custom command by using +greet <Mention user>

Anything else?

No response

Flame442 commented 1 year ago

I think this is a duplicate of #6138.

scarecr0w12 commented 1 year ago

Most likely, I didn't know if all parameters were treated equally with this cog.

Flame442 commented 1 year ago

Considering the error is the same, and the only difference is the addition of typehints and attribute fetching (which is an expansion of the features used in the other report), I'm going to close this as a duplicate. Fixing that issue is currently planned for 3.5.2, so hopefully there will be a fix soon!