Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext.bridge): Bridge options & bool converter breaking sometimes #1999

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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