Skip to content

Commit 14ddc85

Browse files
committed
🐛 Fix implementation
1 parent 3497f23 commit 14ddc85

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

discord/ext/commands/help.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import functools
3030
import itertools
3131
import re
32-
from typing import TYPE_CHECKING
32+
from typing import TYPE_CHECKING, Any
3333

3434
import discord.utils
3535
from discord.ext import bridge
@@ -551,7 +551,9 @@ def subcommand_not_found(self, command, string):
551551
)
552552
return f'Command "{command.qualified_name}" has no subcommands.'
553553

554-
async def filter_commands(self, commands, *, sort=False, key=None):
554+
async def filter_commands(
555+
self, commands, *, sort=False, key=None, exclude: tuple[Any] | None = None
556+
):
555557
"""|coro|
556558
557559
Returns a filtered list of commands and optionally sorts them.
@@ -580,17 +582,18 @@ async def filter_commands(self, commands, *, sort=False, key=None):
580582
key = lambda c: c.name
581583

582584
# Ignore Application Commands because they don't have hidden/docs
583-
prefix_commands = [
585+
new_commands = [
584586
command
585587
for command in commands
586588
if not isinstance(
587-
command, (discord.commands.ApplicationCommand, bridge.BridgeExtCommand)
589+
command,
590+
(discord.commands.ApplicationCommand, *(exclude if exclude else ())),
588591
)
589592
]
590593
iterator = (
591-
prefix_commands
594+
new_commands
592595
if self.show_hidden
593-
else filter(lambda c: not c.hidden, prefix_commands)
596+
else filter(lambda c: not c.hidden, new_commands)
594597
)
595598

596599
if self.verify_checks is False:
@@ -1110,7 +1113,9 @@ async def send_cog_help(self, cog):
11101113
self.paginator.add_line(cog.description, empty=True)
11111114

11121115
filtered = await self.filter_commands(
1113-
cog.get_commands(), sort=self.sort_commands
1116+
cog.get_commands(),
1117+
sort=self.sort_commands,
1118+
exclude=(bridge.BridgeExtCommand,),
11141119
)
11151120
self.add_indented_commands(filtered, heading=self.commands_heading)
11161121

@@ -1360,7 +1365,9 @@ async def send_cog_help(self, cog):
13601365
self.paginator.add_line(cog.description, empty=True)
13611366

13621367
filtered = await self.filter_commands(
1363-
cog.get_commands(), sort=self.sort_commands
1368+
cog.get_commands(),
1369+
sort=self.sort_commands,
1370+
exclude=(bridge.BridgeExtCommand,),
13641371
)
13651372
if filtered:
13661373
self.paginator.add_line(f"**{cog.qualified_name} {self.commands_heading}**")

0 commit comments

Comments
 (0)