Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BridgeOption converts discord.Member wrong with ext command #2394

Open
3 tasks done
Revnoplex opened this issue Mar 15, 2024 · 0 comments
Open
3 tasks done

BridgeOption converts discord.Member wrong with ext command #2394

Revnoplex opened this issue Mar 15, 2024 · 0 comments
Labels
unconfirmed bug A bug report that needs triaging

Comments

@Revnoplex
Copy link
Contributor

Revnoplex commented Mar 15, 2024

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

@Revnoplex Revnoplex added the unconfirmed bug A bug report that needs triaging label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

No branches or pull requests

1 participant