aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/ext/commands/help.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py
index 21a87396..c7143317 100644
--- a/discord/ext/commands/help.py
+++ b/discord/ext/commands/help.py
@@ -326,6 +326,49 @@ class HelpCommand:
self._command_impl._eject_cog()
self._command_impl = None
+ def add_check(self, func):
+ """
+ Adds a check to the help command.
+
+ .. versionadded:: 1.4
+
+ Parameters
+ ----------
+ func
+ The function that will be used as a check.
+ """
+
+ if self._command_impl is not None:
+ self._command_impl.add_check(func)
+ else:
+ try:
+ self.command_attrs["checks"].append(func)
+ except KeyError:
+ self.command_attrs["checks"] = [func]
+
+ def remove_check(self, func):
+ """
+ Removes a check from the help command.
+
+ This function is idempotent and will not raise an exception if
+ the function is not in the command's checks.
+
+ .. versionadded:: 1.4
+
+ Parameters
+ ----------
+ func
+ The function to remove from the checks.
+ """
+
+ if self._command_impl is not None:
+ self._command_impl.remove_check(func)
+ else:
+ try:
+ self.command_attrs["checks"].remove(func)
+ except (KeyError, ValueError):
+ pass
+
def get_bot_mapping(self):
"""Retrieves the bot mapping passed to :meth:`send_bot_help`."""
bot = self.context.bot