aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/ext/commands/core.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 38703016..a37dd641 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -278,6 +278,40 @@ class Command(_BaseCommand):
if value.annotation is converters.Greedy:
raise TypeError('Unparameterized Greedy[...] is disallowed in signature.')
+ def add_check(self, func):
+ """Adds a check to the command.
+
+ This is the non-decorator interface to :func:`.check`.
+
+ .. versionadded:: 1.3.0
+
+ Parameters
+ -----------
+ func
+ The function that will be used as a check.
+ """
+
+ self.checks.append(func)
+
+ def remove_check(self, func):
+ """Removes a check from the command.
+
+ This function is idempotent and will not raise an exception
+ if the function is not in the command's checks.
+
+ .. versionadded:: 1.3.0
+
+ Parameters
+ -----------
+ func
+ The function to remove from the checks.
+ """
+
+ try:
+ self.checks.remove(func)
+ except ValueError:
+ pass
+
def update(self, **kwargs):
"""Updates :class:`Command` instance with updated attribute.