We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using bridge.Context in a bridge command raises a TypeError acting like other invalid typehints even though specified as a feature in #2106
bridge.Context
TypeError
Use a bridge command with the context type hint ctx: bridge.Context
ctx: bridge.Context
@bridge.bridge_command(name='test', description="Hello World") @commands.cooldown(**config.default_cooldown_options) @commands.bot_has_permissions(send_messages=True) async def test_cmd(self, ctx: bridge.Context): await ctx.respond("Hello World")
bridge.Context to pass pycord's type hinting checks
bridge.Context fails pycord's type hinting checks which raises TypeError: Invalid usage of typing.Union Traceback associated:
TypeError: Invalid usage of typing.Union
File "bot-dir/venv/lib/python3.11/site-packages/discord/cog.py", line 778, in _load_from_module_spec spec.loader.exec_module(lib) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "bot-dir/cogs/testing.py", line 13, in <module> class Testing(config.RevnobotCog): File "bot-dir/cogs/testing.py", line 21, in Testing @bridge.bridge_command(name='test', description="Hello World") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 425, in decorator return BridgeCommand(callback, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 168, in __init__ ) or BridgeSlashCommand(callback, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/ext/bridge/core.py", line 83, in __init__ super().__init__(func, **kwargs) File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/core.py", line 694, in __init__ self._validate_parameters() File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/core.py", line 712, in _validate_parameters self.options = self._parse_options(params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/core.py", line 760, in _parse_options option = Option(option.__args__) ^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/options.py", line 232, in __init__ raise exc File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/options.py", line 227, in __init__ self.input_type = SlashCommandOptionType.from_datatype(input_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "bot-dir/venv/lib/python3.11/site-packages/discord/enums.py", line 798, in from_datatype raise TypeError("Invalid usage of typing.Union")
all
Also neither does Union[bridge.BridgeExtContext, bridge.BridgeApplicationContext] passes pycord's context type hint checks
Union[bridge.BridgeExtContext, bridge.BridgeApplicationContext]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Summary
Using
bridge.Context
in a bridge command raises aTypeError
acting like other invalid typehints even though specified as a feature in #2106Reproduction Steps
Use a bridge command with the context type hint
ctx: bridge.Context
Minimal Reproducible Code
Expected Results
bridge.Context
to pass pycord's type hinting checksActual Results
bridge.Context
fails pycord's type hinting checks which raisesTypeError: Invalid usage of typing.Union
Traceback associated:
Intents
all
System Information
Checklist
Additional Context
Also neither does
Union[bridge.BridgeExtContext, bridge.BridgeApplicationContext]
passes pycord's context type hint checksThe text was updated successfully, but these errors were encountered: