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

[ext.bridge] Errors while using discord.commands.options.Option with bridge commands. #1244

Closed
3 tasks done
TheGiga opened this issue Apr 10, 2022 · 8 comments
Closed
3 tasks done
Labels
bug Something isn't working ext.bridge Relating to ext.bridge question Further information is requested

Comments

@TheGiga
Copy link
Contributor

TheGiga commented Apr 10, 2022

Summary

Using Option() with bridge commands gives errors. While using Application Command - it works, but with message commands - it don't.

Reproduction Steps

I replaced:

  • discord.Bot with bridge.Bot
  • @slash_command with @bridge_command

Then i just used message command, aka @ping command <argument1 (not Option) <argument2 (Option)>
Application command works.
I gave Option() default argument, and code is working if Argument2 is not specified.

Minimal Reproducible Code

@bot.bridge_command(name='command')
async def command(
        ctx,
        argument1: str,
        argument2: Option(
            SlashCommandOptionType.string,
            choices=["1", "2", "3"]
        )
):
    await ctx.respond('Hey!')

Expected Results

Command works as intended and responds Hey!

Actual Results

Error:

Traceback (most recent call last):
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\converter.py", line 1078, in _actual_conversion
    return converter(argument)
TypeError: 'Option' object is not callable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\bot.py", line 360, in invoke
    await ctx.command.invoke(ctx)
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\core.py", line 919, in invoke
    await self.prepare(ctx)
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\core.py", line 849, in prepare
    await self._parse_arguments(ctx)
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\core.py", line 755, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\core.py", line 605, in transform
    return await run_converters(ctx, converter, argument, param)  # type: ignore
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\converter.py", line 1175, in run_converters
    return await _actual_conversion(ctx, converter, argument, param)
  File "R:\.osu-stats-new\venv\lib\site-packages\discord\ext\commands\converter.py", line 1087, in _actual_conversion
    raise BadArgument(f'Converting to "{name}" failed for parameter "{param.name}".') from exc
discord.ext.commands.errors.BadArgument: Converting to "Option" failed for parameter "mode".

Intents

discord.Intents.default()

System Information

  • Python v3.10.0-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b7
  • aiohttp v3.8.1
  • system info: Windows 10 10.0.19043

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

  • I ping bot for commands, so message_content is not needed
@TheGiga TheGiga added the unconfirmed bug A bug report that needs triaging label Apr 10, 2022
@EmreTech
Copy link
Contributor

For the minimal reproducible code, you need to add another argument since your error focuses on the second argument.

@TheGiga
Copy link
Contributor Author

TheGiga commented Apr 11, 2022

i updated, it will not work whatever, at least, it wasn't yesterday, if there is updates

@EmreTech
Copy link
Contributor

Just reproduced this problem, and I do get the same error

@Dorukyum Dorukyum added bug Something isn't working ext.bridge Relating to ext.bridge and removed unconfirmed bug A bug report that needs triaging labels Apr 11, 2022
@EmreTech
Copy link
Contributor

#1250 should be able to fix this problem

@BobDotCom
Copy link
Member

#1250 should be able to fix this problem

I don't think it changes anything for the detection of converters, have you tested to see if it resolves the issue?

@EmreTech
Copy link
Contributor

Not yet

@Lulalaby
Copy link
Member

Lulalaby commented Jul 4, 2022

Is this still a problem?

@Lulalaby Lulalaby added the question Further information is requested label Jul 4, 2022
@TheGiga
Copy link
Contributor Author

TheGiga commented Jul 4, 2022

Is this still a problem?

no, it seems fixed now.
image

@Lulalaby Lulalaby closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ext.bridge Relating to ext.bridge question Further information is requested
Projects
Status: Done
Development

No branches or pull requests

5 participants