aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/resources/tags/customchecks.md6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/resources/tags/customchecks.md b/bot/resources/tags/customchecks.md
index 96f833430..23ff7a66f 100644
--- a/bot/resources/tags/customchecks.md
+++ b/bot/resources/tags/customchecks.md
@@ -1,6 +1,6 @@
**Custom Command Checks in discord.py**
-You may find yourself in need of a check decorator to do something that doesn't exist in discord.py by default, but fear not, you can make your own! Using discord.py you can use `discord.ext.commands.check` to create you own checks like this:
+Often you may find the need to use checks that don't exist by default in discord.py. Fortunately, discord.py provides `discord.ext.commands.check` which allows you to create you own checks like this:
```py
from discord.ext.commands import check, Context
@@ -9,9 +9,9 @@ def in_any_channel(*channels):
return ctx.channel.id in channels
return check(predicate)
```
-There's a fair bit to break down here, so let's start with what we're trying to achieve with this check. As you can probably guess from the name it's locking a command to a **list of channels**. The inner function named `predicate` is used to perform the actual check on the command context. Here you can do anything that requires a `Context` object. This inner function should return `True` if the check is **successful** or `False` if the check **fails**.
+This check is to check whether the invoked command is in a given set of channels. The inner function, named `predicate` here, is used to perform the actual check on the command, and check logic should go in this function. It must be an async function, and always provides a single `commands.Context` argument which you can use to create check logic. This check function should return a boolean value indicating whether the check passed (return `True`) or failed (return `False`).
-Here's how we might use our new check:
+The check can now be used like any other commands check as a decorator of a command, such as this:
```py
@bot.command(name="ping")
@in_any_channel(728343273562701984)