mirror of
				https://github.com/Rapptz/discord.py.git
				synced 2025-10-26 02:53:07 +00:00 
			
		
		
		
	[commands] Make Bot.check decorator an actual decorator.
This commit is contained in:
		| @@ -446,7 +446,7 @@ class Bot(GroupMixin, discord.Client): | |||||||
|  |  | ||||||
|     # global check registration |     # global check registration | ||||||
|  |  | ||||||
|     def check(self): |     def check(self, func): | ||||||
|         """A decorator that adds a global check to the bot. |         """A decorator that adds a global check to the bot. | ||||||
|  |  | ||||||
|         A global check is similar to a :func:`check` that is applied |         A global check is similar to a :func:`check` that is applied | ||||||
| @@ -466,15 +466,13 @@ class Bot(GroupMixin, discord.Client): | |||||||
|  |  | ||||||
|         .. code-block:: python |         .. code-block:: python | ||||||
|  |  | ||||||
|             @bot.check() |             @bot.check | ||||||
|             def whitelist(ctx): |             def whitelist(ctx): | ||||||
|                 return ctx.message.author.id in my_whitelist |                 return ctx.message.author.id in my_whitelist | ||||||
|  |  | ||||||
|         """ |         """ | ||||||
|         def decorator(func): |  | ||||||
|         self.add_check(func) |         self.add_check(func) | ||||||
|         return func |         return func | ||||||
|         return decorator |  | ||||||
|  |  | ||||||
|     def add_check(self, func): |     def add_check(self, func): | ||||||
|         """Adds a global check to the bot. |         """Adds a global check to the bot. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user