disabled help hideaways (#2892)

* disabled help hideaways

* can_see fix
This commit is contained in:
Michael H 2019-07-27 02:36:21 -04:00 committed by GitHub
parent af096bc1cc
commit 6280fd9c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

1
changelog.d/2863.fix.rst Normal file
View File

@ -0,0 +1 @@
Help properly hides disabled commands.

View File

@ -0,0 +1 @@
Red's Help Formatter is now considered to have a stable API.

View File

@ -0,0 +1 @@
``Command.can_see`` now works as intended for disabled commands

View File

@ -328,7 +328,7 @@ class Command(CogCommandMixin, commands.Command):
can_run = await self.can_run(
ctx, check_all_parents=True, change_permission_state=False
)
except commands.CheckFailure:
except (commands.CheckFailure, commands.errors.DisabledCommand):
return False
else:
if can_run is False:

View File

@ -1,7 +1,6 @@
# This is a full replacement of discord.py's help command
# Signatures are not guaranteed to be unchanging in this file.
# At a later date when this is more set in stone, this warning will be removed.
# At said later date, there should also be things added to support extra formatter
#
# At a later date, there should be things added to support extra formatter
# registration from 3rd party cogs.
#
# This exists due to deficiencies in discord.py which conflict
@ -441,14 +440,14 @@ class RedHelpFormatter:
for obj in objects:
if verify_checks and not show_hidden:
# Default Red behavior, can_see includes a can_run check.
if await obj.can_see(ctx):
if await obj.can_see(ctx) and getattr(obj, "enabled", True):
yield obj
elif verify_checks:
try:
can_run = await obj.can_run(ctx)
except discord.DiscordException:
can_run = False
if can_run:
if can_run and getattr(obj, "enabled", True):
yield obj
elif not show_hidden:
if not getattr(obj, "hidden", False): # Cog compatibility