Skip to content

Commit 4584bec

Browse files
Middledotpre-commit-ci[bot]BobDotCom
authored
fix(ext.bridge): Bridge options & bool converter breaking sometimes (#1999)
* fix(ext.bridge): bool opt breaks sometimes * chore(changelog): changelog * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Middledot <78228142+Middledot@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
1 parent f5e780a commit 4584bec

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ These changes are available on the `master` branch, but have not yet been releas
4545
([#1994](https://github.com/Pycord-Development/pycord/pull/1994))
4646
- Fixed scheduled events breaking when changing the location from external to a channel.
4747
([#1998](https://github.com/Pycord-Development/pycord/pull/1998))
48+
- Fixed boolean converter breaking for bridge commands. Fix bridge command Options not
49+
working. ([#1999](https://github.com/Pycord-Development/pycord/pull/1999))
4850
- Fixed `TypeError` being raised when passing `name` argument to bridge groups.
4951
([#2000](https://github.com/Pycord-Development/pycord/pull/2000))
5052

discord/ext/bridge/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,15 @@ async def convert(self, ctx: Context, arg: str):
532532
return attach
533533

534534

535+
class BooleanConverter(Converter):
536+
async def convert(self, ctx, arg: bool):
537+
return _convert_to_bool(str(arg))
538+
539+
535540
BRIDGE_CONVERTER_MAPPING = {
536541
SlashCommandOptionType.string: str,
537542
SlashCommandOptionType.integer: int,
538-
SlashCommandOptionType.boolean: lambda val: _convert_to_bool(str(val)),
543+
SlashCommandOptionType.boolean: BooleanConverter,
539544
SlashCommandOptionType.user: UserConverter,
540545
SlashCommandOptionType.channel: GuildChannelConverter,
541546
SlashCommandOptionType.role: RoleConverter,
@@ -579,3 +584,4 @@ async def convert(self, ctx, argument: str) -> Any:
579584

580585

581586
discord.commands.options.Option = BridgeOption
587+
discord.Option = BridgeOption

0 commit comments

Comments
 (0)