diff options
| author | Rapptz <[email protected]> | 2017-06-20 23:40:59 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-06-20 23:41:13 -0400 |
| commit | 717f11d635f71f49e1c83813bc97fcc9ac744cc3 (patch) | |
| tree | 36c3e09f14806ed788bd91c5a95ea6bc6474acd4 /docs | |
| parent | Fix passing None to afk_channel in Guild.edit. (diff) | |
| download | discord.py-717f11d635f71f49e1c83813bc97fcc9ac744cc3.tar.xz discord.py-717f11d635f71f49e1c83813bc97fcc9ac744cc3.zip | |
[commands] Add Bot.check_once for a global check that is called once.
There is a counterpart for this in cogs, called __global_check_once.
This allows for predicates that would filter a command globally that
do not necessarily require rechecking in the case of e.g. the help
command such as blocking users or blocking channels.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/migrating.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/migrating.rst b/docs/migrating.rst index ccf5e2b1..fbcc074a 100644 --- a/docs/migrating.rst +++ b/docs/migrating.rst @@ -918,7 +918,9 @@ The previous ``__check`` special method has been renamed to ``__global_check`` t check. To complement the new ``__global_check`` there is now a new ``__local_check`` to facilitate a check that will run on -every command in the cog. +every command in the cog. There is also a ``__global_check_once``, which is similar to a global check instead it is only +called once per :meth:`.Bot.invoke` call rather than every :meth:`.Command.invoke` call. Practically, the difference is +only for black-listing users or channels without constantly opening a database connection. Cogs have also gained a ``__before_invoke`` and ``__after_invoke`` cog local before and after invocation hook, which can be seen in :ref:`migrating_1_0_before_after_hook`. |