Skip to content

Commit acf0c7a

Browse files
chore!: 🔥 Remove deprecated support for Option in bridge commands (#2731)
* 🔥 Remove deprecated support for Option in bridge commands * 📝 CHANGELOG.md * ♻️ Better logic --------- Co-authored-by: Dorukyum <[email protected]>
1 parent f944b25 commit acf0c7a

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ These changes are available on the `master` branch, but have not yet been releas
144144
- Deprecated `Interaction.cached_channel` in favor of `Interaction.channel`.
145145
([#2658](https://github.com/Pycord-Development/pycord/pull/2658))
146146

147+
### Removed
148+
149+
- Removed deprecated support for `Option` in `BridgeCommand`. Use `BridgeOption`
150+
instead. ([#2731])(https://github.com/Pycord-Development/pycord/pull/2731))
151+
147152
## [2.6.1] - 2024-09-15
148153

149154
### Fixed

discord/ext/bridge/core.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,12 @@ class BridgeExtCommand(Command):
9898
def __init__(self, func, **kwargs):
9999
super().__init__(func, **kwargs)
100100

101-
# TODO: v2.7: Remove backwards support for Option in bridge commands.
102-
for name, option in self.params.items():
101+
for option in self.params.values():
103102
if isinstance(option.annotation, Option) and not isinstance(
104103
option.annotation, BridgeOption
105104
):
106-
# Warn not to do this
107-
warn_deprecated(
108-
"Using Option for bridge commands",
109-
"BridgeOption",
110-
"2.5",
111-
"2.7",
112-
reference="https://github.com/Pycord-Development/pycord/pull/2417",
113-
stacklevel=6,
114-
)
115-
# Override the convert method of the parameter's annotated Option.
116-
# We can use the convert method from BridgeOption, and bind "self"
117-
# using a manual invocation of the descriptor protocol.
118-
# Definitely not a good approach, but gets the job done until removal.
119-
self.params[name].annotation.convert = BridgeOption.convert.__get__(
120-
self.params[name].annotation
105+
raise TypeError(
106+
f"{option.annotation.__class__.__name__} is not supported in bridge commands. Use BridgeOption instead."
121107
)
122108

123109
async def dispatch_error(self, ctx: BridgeExtContext, error: Exception) -> None:

0 commit comments

Comments
 (0)