From c8937ed2aa59ca52bf4983b48f1e6bef76a49115 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 1 May 2017 22:36:22 -0400 Subject: [PATCH] [commands] Add is_nsfw check. --- discord/ext/commands/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index faac03d1d..fb1bce5aa 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.