diff options
| author | Rapptz <[email protected]> | 2017-05-01 22:36:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-01 22:36:22 -0400 |
| commit | c8937ed2aa59ca52bf4983b48f1e6bef76a49115 (patch) | |
| tree | 51d75c6c8109bc73f99bbf13c478bd3ca2cdf696 | |
| parent | Make sure that the chunker task only runs once. (diff) | |
| download | discord.py-c8937ed2aa59ca52bf4983b48f1e6bef76a49115.tar.xz discord.py-c8937ed2aa59ca52bf4983b48f1e6bef76a49115.zip | |
[commands] Add is_nsfw check.
| -rw-r--r-- | discord/ext/commands/core.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index faac03d1..fb1bce5a 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1122,6 +1122,12 @@ def is_owner(): return check(predicate) +def is_nsfw(): + """A :func:`check` that checks if the channel is a NSFW channel.""" + def pred(ctx): + return isinstance(ctx.channel, discord.TextChannel) and ctx.channel.is_nsfw() + return check(pred) + def cooldown(rate, per, type=BucketType.default): """A decorator that adds a cooldown to a :class:`Command` or its subclasses. |