Summary
Bridge commands do not always handle default arguments in the same way
Reproduction Steps
- Create a bridge command with non-required argument (via Option kwargs)
- Try to run it without the argument in question
Minimal Reproducible Code
import os
import discord
from discord.ext import bridge
# Option MUST be imported after ext.bridge
# otherwise it won't work with bridge commands
from discord import Option
bot = bridge.Bot()
@bot.bridge_command()
async def test_default1(ctx, text: Option(str) = "hello"):
await ctx.respond(text)
@bot.bridge_command()
async def test_default2(ctx, text: Option(str, default="hello")):
await ctx.respond(text)
@bot.bridge_command()
async def test_no_default(ctx, text: Option(str, required=False)):
await ctx.respond(text or "hello")
bot.run(os.getenv("TOKEN"))
Expected Results
I'd expect all three commands from the above code to produce the same output when the argument isn't provided, like it does for slash variants:

Actual Results
However, only the first one works:

Others are throwing an error:
Traceback (most recent call last):
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/bridge/bot.py", line 143, in invoke
await ctx.command.invoke(ctx)
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/commands/core.py", line 942, in invoke
await self.prepare(ctx)
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/commands/core.py", line 872, in prepare
await self._parse_arguments(ctx)
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/commands/core.py", line 774, in _parse_arguments
transformed = await self.transform(ctx, param)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 105, in transform
return await super().transform(ctx, param)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/home/tests/lib/python3.11/site-packages/discord/ext/commands/core.py", line 601, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: text is a required argument that is missing.
Intents
None
System Information
- Python v3.11.2-final
- py-cord v2.4.1-final
- aiohttp v3.8.4
- system info:
Linux 4.14.232-QuicksilveR™-ReloadedOS-Edition #1 SMP PREEMPT Wed May 26 07:08:17 UTC 2021
Checklist
Additional Context
Not related to this particular issue, but I don't quite like how Option works with bridge commands. Relying on the order of imports is something very non-obvious, confusing and, iirc, not documented.
Summary
Bridge commands do not always handle default arguments in the same way
Reproduction Steps
Minimal Reproducible Code
Expected Results
I'd expect all three commands from the above code to produce the same output when the argument isn't provided, like it does for slash variants:

Actual Results
However, only the first one works:

Others are throwing an error:
Intents
None
System Information
Linux 4.14.232-QuicksilveR™-ReloadedOS-Edition #1 SMP PREEMPT Wed May 26 07:08:17 UTC 2021Checklist
Additional Context
Not related to this particular issue, but I don't quite like how Option works with bridge commands. Relying on the order of imports is something very non-obvious, confusing and, iirc, not documented.