discord.py icon indicating copy to clipboard operation
discord.py copied to clipboard

Attachment converter does not capture attachments for VAR_POSITIONAL parameters

Open Zephyrkul opened this issue 1 year ago • 0 comments

Summary

Attachment converter does not capture attachments for VAR_POSITIONAL parameters

Reproduction Steps

Create a command with a VAR_POSITIONAL (aka *args) parameter with the discord.Attachment typehint, then run it.

Minimal Reproducible Code

bot = commands.Bot(command_prefix=["--"], intents=discord.Intents.all())

@bot.command()
async def foo(ctx, *imgs: discord.Attachment):
    await ctx.send(ctx.message.attachments)
    await ctx.send(imgs)  # always shows an empty tuple no matter the state of .attachments

bot.run("<TOKEN>")

Expected Results

To receive a tuple of attached files in the parameter, OR for an error of some form to be raised to indicate that Attachment is an invalid converter type for VAR_POSITIONAL parameters

Actual Results

Parameter is accepted as valid by the command framework but is always an empty tuple

Intents

discord.Intents.all()

System Information

  • Python v3.12.2-final
  • discord.py v2.4.0-alpha
    • discord.py metadata: v2.4.0a5006+g8fd1fd80
  • aiohttp v3.9.5
  • system info: Windows 11 10.0.22621

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.
  • [X] I have removed my token from display, if visible.

Additional Context

Other parameter types, as well as commands.Greedy, still work as expected.

Zephyrkul avatar Apr 24 '24 22:04 Zephyrkul