Skip to content

Commit 2731d21

Browse files
MiddledotDorukyumpre-commit-ci[bot]
authored
chore(bridge): use BridgeOption instead of Option (Pycord-Development#2252)
* chore(bridge): force BridgeOption * docs: updates Signed-off-by: Dorukyum <[email protected]> * style(pre-commit): auto fixes from pre-commit.com hooks * fix: export `BridgeContext` * fix: I might have dyslexia Signed-off-by: Dorukyum <[email protected]> * docs: better * docs: add changelog entry --------- Signed-off-by: Dorukyum <[email protected]> Co-authored-by: Dorukyum <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6632e6f commit 2731d21

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ These changes are available on the `master` branch, but have not yet been releas
115115
([#2099](https://github.com/Pycord-Development/pycord/pull/2099))
116116
- Changed the support from `orjson` to `msgspec` in the codebase.
117117
([#2170](https://github.com/Pycord-Development/pycord/pull/2170))
118+
- `BridgeOption` must now be used for arguments in bridge commands.
119+
([#2252](https://github.com/Pycord-Development/pycord/pull/2252))
118120

119121
### Removed
120122

discord/ext/bridge/core.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"BridgeSlashCommand",
6767
"BridgeExtGroup",
6868
"BridgeSlashGroup",
69+
"BridgeOption",
6970
"map_to",
7071
"guild_only",
7172
"has_permissions",
@@ -591,6 +592,10 @@ async def convert(self, ctx, arg: bool):
591592

592593

593594
class BridgeOption(Option, Converter):
595+
"""A subclass of :class:`discord.Option` which represents a selectable slash
596+
command option and a prefixed command argument for bridge commands.
597+
"""
598+
594599
async def convert(self, ctx, argument: str) -> Any:
595600
try:
596601
if self.converter is not None:
@@ -621,7 +626,3 @@ async def convert(self, ctx, argument: str) -> Any:
621626
return converted
622627
except ValueError as exc:
623628
raise BadArgument() from exc
624-
625-
626-
discord.commands.options.Option = BridgeOption
627-
discord.Option = BridgeOption

docs/ext/bridge/api.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,14 @@ BridgeContext Subclasses
157157
.. data:: discord.ext.bridge.Context
158158

159159
Alias of :data:`typing.Union` [ :class:`.BridgeExtContext`, :class:`.BridgeApplicationContext` ] for typing convenience.
160+
161+
Option
162+
------
163+
164+
BridgeOption
165+
~~~~~~~~~~~~
166+
167+
.. attributetable:: discord.ext.bridge.BridgeOption
168+
169+
.. autoclass:: discord.ext.bridge.BridgeOption
170+
:members:

0 commit comments

Comments
 (0)