mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
disabled help hideaways (#2892)
* disabled help hideaways * can_see fix
This commit is contained in:
parent
af096bc1cc
commit
6280fd9c28
1
changelog.d/2863.fix.rst
Normal file
1
changelog.d/2863.fix.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Help properly hides disabled commands.
|
||||||
1
changelog.d/2892.enhance.rst
Normal file
1
changelog.d/2892.enhance.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Red's Help Formatter is now considered to have a stable API.
|
||||||
1
changelog.d/2892.fix.1.rst
Normal file
1
changelog.d/2892.fix.1.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
``Command.can_see`` now works as intended for disabled commands
|
||||||
@ -328,7 +328,7 @@ class Command(CogCommandMixin, commands.Command):
|
|||||||
can_run = await self.can_run(
|
can_run = await self.can_run(
|
||||||
ctx, check_all_parents=True, change_permission_state=False
|
ctx, check_all_parents=True, change_permission_state=False
|
||||||
)
|
)
|
||||||
except commands.CheckFailure:
|
except (commands.CheckFailure, commands.errors.DisabledCommand):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if can_run is False:
|
if can_run is False:
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
# This is a full replacement of discord.py's help command
|
# 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 a later date, there should be things added to support extra formatter
|
||||||
# At said later date, there should also be things added to support extra formatter
|
|
||||||
# registration from 3rd party cogs.
|
# registration from 3rd party cogs.
|
||||||
#
|
#
|
||||||
# This exists due to deficiencies in discord.py which conflict
|
# This exists due to deficiencies in discord.py which conflict
|
||||||
@ -441,14 +440,14 @@ class RedHelpFormatter:
|
|||||||
for obj in objects:
|
for obj in objects:
|
||||||
if verify_checks and not show_hidden:
|
if verify_checks and not show_hidden:
|
||||||
# Default Red behavior, can_see includes a can_run check.
|
# 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
|
yield obj
|
||||||
elif verify_checks:
|
elif verify_checks:
|
||||||
try:
|
try:
|
||||||
can_run = await obj.can_run(ctx)
|
can_run = await obj.can_run(ctx)
|
||||||
except discord.DiscordException:
|
except discord.DiscordException:
|
||||||
can_run = False
|
can_run = False
|
||||||
if can_run:
|
if can_run and getattr(obj, "enabled", True):
|
||||||
yield obj
|
yield obj
|
||||||
elif not show_hidden:
|
elif not show_hidden:
|
||||||
if not getattr(obj, "hidden", False): # Cog compatibility
|
if not getattr(obj, "hidden", False): # Cog compatibility
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user