Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 26, 2022
1 parent 0bad348 commit 860d0b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions discord/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
# r.e type ignore, type-checker complains about overriding a ClassVar
new_cls.__cog_commands__ = tuple(c._update_copy(cmd_attrs) if not hasattr(c, "add_to") else c for c in new_cls.__cog_commands__) # type: ignore

name_filter = lambda c: "app" if isinstance(c, ApplicationCommand) else ("bridge" if not hasattr(c, "add_to") else "ext")
name_filter = (
lambda c: "app"
if isinstance(c, ApplicationCommand)
else ("bridge" if not hasattr(c, "add_to") else "ext")
)

lookup = {
f"{name_filter(cmd)}_{cmd.qualified_name}": cmd
Expand All @@ -248,7 +252,9 @@ def __new__(cls: type[CogMeta], *args: Any, **kwargs: Any) -> CogMeta:
):
command.guild_ids = new_cls.__cog_guild_ids__

if not isinstance(command, SlashCommandGroup) and not hasattr(command, "add_to"):
if not isinstance(command, SlashCommandGroup) and not hasattr(
command, "add_to"
):
# ignore bridge commands
cmd = getattr(new_cls, command.callback.__name__, None)
if hasattr(cmd, "add_to"):
Expand Down

0 comments on commit 860d0b1

Please sign in to comment.