Skip to content

Commit

Permalink
fix(ext.bridge): Bridge options & bool converter breaking sometimes (#…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
3 people committed Apr 17, 2023
1 parent f5e780a commit 4584bec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ These changes are available on the `master` branch, but have not yet been releas
([#1994](https://github.com/Pycord-Development/pycord/pull/1994))
- Fixed scheduled events breaking when changing the location from external to a channel.
([#1998](https://github.com/Pycord-Development/pycord/pull/1998))
- Fixed boolean converter breaking for bridge commands. Fix bridge command Options not
working. ([#1999](https://github.com/Pycord-Development/pycord/pull/1999))
- Fixed `TypeError` being raised when passing `name` argument to bridge groups.
([#2000](https://github.com/Pycord-Development/pycord/pull/2000))

Expand Down
8 changes: 7 additions & 1 deletion discord/ext/bridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,15 @@ async def convert(self, ctx: Context, arg: str):
return attach


class BooleanConverter(Converter):
async def convert(self, ctx, arg: bool):
return _convert_to_bool(str(arg))


BRIDGE_CONVERTER_MAPPING = {
SlashCommandOptionType.string: str,
SlashCommandOptionType.integer: int,
SlashCommandOptionType.boolean: lambda val: _convert_to_bool(str(val)),
SlashCommandOptionType.boolean: BooleanConverter,
SlashCommandOptionType.user: UserConverter,
SlashCommandOptionType.channel: GuildChannelConverter,
SlashCommandOptionType.role: RoleConverter,
Expand Down Expand Up @@ -579,3 +584,4 @@ async def convert(self, ctx, argument: str) -> Any:


discord.commands.options.Option = BridgeOption
discord.Option = BridgeOption

0 comments on commit 4584bec

Please sign in to comment.