From f719cbce5a93ba67c56754386e67caf44d96b3bb Mon Sep 17 00:00:00 2001 From: Middledot Date: Sun, 29 Oct 2023 04:16:17 -0400 Subject: [PATCH 1/7] chore(bridge): force BridgeOption --- discord/ext/bridge/core.py | 6 ++---- docs/ext/bridge/api.rst | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index 427bd0269f..02a545c053 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -591,6 +591,8 @@ async def convert(self, ctx, arg: bool): class BridgeOption(Option, Converter): + """Slash command option for bridge commands. Otherwise equivalent in every way to :class:`discord.Option`.""" + async def convert(self, ctx, argument: str) -> Any: try: if self.converter is not None: @@ -621,7 +623,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 diff --git a/docs/ext/bridge/api.rst b/docs/ext/bridge/api.rst index d8f4d78821..321d04dd71 100644 --- a/docs/ext/bridge/api.rst +++ b/docs/ext/bridge/api.rst @@ -157,3 +157,9 @@ BridgeContext Subclasses .. data:: discord.ext.bridge.Context Alias of :data:`typing.Union` [ :class:`.BridgeExtContext`, :class:`.BridgeApplicationContext` ] for typing convenience. + +Option +------ + +BridgeOption +~~~~~~~~~~~~ From ec4a8198728467f74749b9eaa3a5fd539dfc9127 Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:50:26 +0300 Subject: [PATCH 2/7] docs: updates Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> --- discord/ext/bridge/core.py | 3 ++- docs/ext/bridge/api.rst | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index 02a545c053..959b1819f1 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -591,7 +591,8 @@ async def convert(self, ctx, arg: bool): class BridgeOption(Option, Converter): - """Slash command option for bridge commands. Otherwise equivalent in every way to :class:`discord.Option`.""" + """Represents a selectable slash command option and a prefixed command argument for bridge commands. + """ async def convert(self, ctx, argument: str) -> Any: try: diff --git a/docs/ext/bridge/api.rst b/docs/ext/bridge/api.rst index 321d04dd71..75dfdb51de 100644 --- a/docs/ext/bridge/api.rst +++ b/docs/ext/bridge/api.rst @@ -163,3 +163,8 @@ Option BridgeOption ~~~~~~~~~~~~ + +.. attributetable:: discord.ext.bridge.BridgeOption + +.. autoclass:: discord.ext.bridge.BridgeOption + :members: From 1af71d31a2adcfb826ec0805737d5803af704c11 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:52:24 +0000 Subject: [PATCH 3/7] style(pre-commit): auto fixes from pre-commit.com hooks --- discord/ext/bridge/core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index 959b1819f1..c298741fee 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -591,8 +591,7 @@ async def convert(self, ctx, arg: bool): class BridgeOption(Option, Converter): - """Represents a selectable slash command option and a prefixed command argument for bridge commands. - """ + """Represents a selectable slash command option and a prefixed command argument for bridge commands.""" async def convert(self, ctx, argument: str) -> Any: try: From 2081550e26b11da2d7c8b7d04c4ff764d86b8f50 Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:56:38 +0300 Subject: [PATCH 4/7] fix: export `BridgeContext` --- discord/ext/bridge/core.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index c298741fee..c3b7a87dd5 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -66,6 +66,7 @@ "BridgeSlashCommand", "BridgeExtGroup", "BridgeSlashGroup", + "BridgeContext", "map_to", "guild_only", "has_permissions", From 5573b92fb063235610b5b7200c74c243f5c5c6dc Mon Sep 17 00:00:00 2001 From: Dorukyum <53639936+Dorukyum@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:58:31 +0300 Subject: [PATCH 5/7] fix: I might have dyslexia Signed-off-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com> --- discord/ext/bridge/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index c3b7a87dd5..c3e0d08d01 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -66,7 +66,7 @@ "BridgeSlashCommand", "BridgeExtGroup", "BridgeSlashGroup", - "BridgeContext", + "BridgeOption", "map_to", "guild_only", "has_permissions", From 248539562f645b98b62a45ab75edb9b1369784db Mon Sep 17 00:00:00 2001 From: Dorukyum Date: Sun, 21 Jan 2024 17:31:28 +0300 Subject: [PATCH 6/7] docs: better --- discord/ext/bridge/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/ext/bridge/core.py b/discord/ext/bridge/core.py index c3e0d08d01..46b94fac2b 100644 --- a/discord/ext/bridge/core.py +++ b/discord/ext/bridge/core.py @@ -592,7 +592,9 @@ async def convert(self, ctx, arg: bool): class BridgeOption(Option, Converter): - """Represents a selectable slash command option and a prefixed command argument for bridge commands.""" + """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: From 5954e0549df1a880aa01064719158fb14029f76c Mon Sep 17 00:00:00 2001 From: Dorukyum Date: Sun, 21 Jan 2024 17:34:19 +0300 Subject: [PATCH 7/7] docs: add changelog entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fea137c75a..32d584888e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,6 +113,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