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

chore(bridge): use BridgeOption instead of Option #2252

Merged
merged 13 commits into from
Jan 25, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#2099](https://github.com/Pycord-Development/pycord/pull/2099))
- Changed the support from `orjson` to `msgspec` in the codebase.
([#2170](https://github.com/Pycord-Development/pycord/pull/2170))
- `BridgeOption` must now be used for arguments in bridge commands.
([#2252](https://github.com/Pycord-Development/pycord/pull/2252))

### Removed

Expand Down
9 changes: 5 additions & 4 deletions discord/ext/bridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"BridgeSlashCommand",
"BridgeExtGroup",
"BridgeSlashGroup",
"BridgeOption",
"map_to",
"guild_only",
"has_permissions",
Expand Down Expand Up @@ -591,6 +592,10 @@ async def convert(self, ctx, arg: bool):


class BridgeOption(Option, Converter):
"""A subclass of :class:`discord.Option` which represents a selectable slash
command option and a prefixed command argument for bridge commands.
"""

async def convert(self, ctx, argument: str) -> Any:
try:
if self.converter is not None:
Expand Down Expand Up @@ -621,7 +626,3 @@ async def convert(self, ctx, argument: str) -> Any:
return converted
except ValueError as exc:
raise BadArgument() from exc


discord.commands.options.Option = BridgeOption
discord.Option = BridgeOption
11 changes: 11 additions & 0 deletions docs/ext/bridge/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,14 @@ BridgeContext Subclasses
.. data:: discord.ext.bridge.Context

Alias of :data:`typing.Union` [ :class:`.BridgeExtContext`, :class:`.BridgeApplicationContext` ] for typing convenience.

Option
------

BridgeOption
~~~~~~~~~~~~
Dorukyum marked this conversation as resolved.
Show resolved Hide resolved

.. attributetable:: discord.ext.bridge.BridgeOption

.. autoclass:: discord.ext.bridge.BridgeOption
:members:
Loading