aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsudosnok <[email protected]>2021-02-24 10:40:35 +0000
committerGitHub <[email protected]>2021-02-24 05:40:35 -0500
commit01d8502c83b884740aaba34f31094aef044ced9d (patch)
tree3f2e7e5f35e34fd4d6ea332c0607c4d1b707b8f0
parentfix mention_author in send causing unexpected allowed mentions (diff)
downloaddiscord.py-01d8502c83b884740aaba34f31094aef044ced9d.tar.xz
discord.py-01d8502c83b884740aaba34f31094aef044ced9d.zip
[commands] Added tribool behaviour to HelpCommand.verify_checks
-rw-r--r--discord/ext/commands/help.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py
index 2dd94fcd..e8606f8f 100644
--- a/discord/ext/commands/help.py
+++ b/discord/ext/commands/help.py
@@ -272,9 +272,13 @@ class HelpCommand:
show_hidden: :class:`bool`
Specifies if hidden commands should be shown in the output.
Defaults to ``False``.
- verify_checks: :class:`bool`
+ verify_checks: Optional[:class:`bool`]
Specifies if commands should have their :attr:`.Command.checks` called
- and verified. Defaults to ``True``.
+ and verified. If ``True``, always calls :attr:`.Commands.checks`.
+ If ``None``, only calls :attr:`.Commands.checks` in a guild setting.
+ If ``False``, never calls :attr:`.Commands.checks`. Defaults to ``True``.
+
+ ..versionchanged:: 1.7
command_attrs: :class:`dict`
A dictionary of options to pass in for the construction of the help command.
This allows you to change the command behaviour without actually changing
@@ -568,11 +572,15 @@ class HelpCommand:
iterator = commands if self.show_hidden else filter(lambda c: not c.hidden, commands)
- if not self.verify_checks:
+ if self.verify_checks is False:
# if we do not need to verify the checks then we can just
# run it straight through normally without using await.
return sorted(iterator, key=key) if sort else list(iterator)
+ if self.verify_checks is None and not self.context.guild:
+ # if verify_checks is None and we're in a DM, don't verify
+ return sorted(iterator, key=key) if sort else list(iterator)
+
# if we're here then we need to check every command if it can run
async def predicate(cmd):
try: