Skip to content

BridgeOption converts discord.Member wrong with ext command #2394

Open
@Revnoplex

Description

Summary

BridgeOption converts discord.Member to a discord.User object when using the ext version unlike the slash version. Specifying discord.Member without BridgeOption works fine with both variants of the bridge command

Reproduction Steps

Use a bridge command with an argument that has the BridgeOption converter with discord.Member as an argument.

Minimal Reproducible Code

@bridge.bridge_command(name='test', description="Hello World")
async def test_cmd(
    self, ctx: bridge.BridgeContext,
    member: BridgeOption(discord.Member, "A server member")
):
    await ctx.respond(f"{type(member)}")

Expected Results

For both the ext and slash command version to return a discord.Member objects like using discord.Member without a BridgeOption converter

Actual Results

The ext variant of the command gets a discord.User object instead of a discord.Member object like the slash variant gets or the version without the converter gets.
This can cause unexpected discord.User objects when running the ext variant that can cause problems like

File "bot-root/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 180, in wrapped
  ret = await coro(*args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "bot-root/cogs/mod.py", line 1061, in mute_cmd
  await member.add_roles(role, reason=reason)
        ^^^^^^^^^^^^^^^^
AttributeError: 'User' object has no attribute 'add_roles'

Note: traceback not related to minimal reproduction code

Intents

all

System Information

  • Python v3.11.8-final
  • py-cord v2.5.1-final
  • aiohttp v3.9.3
  • system info: Linux 6.7.9-arch1-1 Update README.rst #1 SMP PREEMPT_DYNAMIC Fri, 08 Mar 2024 01:59:01 +0000

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

No response

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions