diff options
| author | Rapptz <[email protected]> | 2016-07-08 04:24:49 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-07-08 04:29:11 -0400 |
| commit | cd87f247d352e2f87bd172e26e2bb0e42168f805 (patch) | |
| tree | 59bccf74297186947d6f177e4bd3a24b7c612b92 | |
| parent | [commands] Added missing parenthesis in examples (diff) | |
| download | discord.py-cd87f247d352e2f87bd172e26e2bb0e42168f805.tar.xz discord.py-cd87f247d352e2f87bd172e26e2bb0e42168f805.zip | |
[commands] Make Bot.check decorator an actual decorator.
| -rw-r--r-- | discord/ext/commands/bot.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 38260a50..7250f3a6 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -446,7 +446,7 @@ class Bot(GroupMixin, discord.Client): # global check registration - def check(self): + def check(self, func): """A decorator that adds a global check to the bot. A global check is similar to a :func:`check` that is applied @@ -466,15 +466,13 @@ class Bot(GroupMixin, discord.Client): .. code-block:: python - @bot.check() + @bot.check def whitelist(ctx): return ctx.message.author.id in my_whitelist """ - def decorator(func): - self.add_check(func) - return func - return decorator + self.add_check(func) + return func def add_check(self, func): """Adds a global check to the bot. |