aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-04-20 17:27:04 -0400
committerRapptz <[email protected]>2019-04-20 17:27:04 -0400
commit188bd4e7086b7121427ed14f3ea5c1f0261291a7 (patch)
treea1cc13105864b8b62b0fd50e6d1ee1ed6ec307f0
parentConsistent use of __all__ to prevent merge conflicts. (diff)
downloaddiscord.py-188bd4e7086b7121427ed14f3ea5c1f0261291a7.tar.xz
discord.py-188bd4e7086b7121427ed14f3ea5c1f0261291a7.zip
[commands] DM channels are NSFW in commands.is_nsfw check.
-rw-r--r--discord/ext/commands/core.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index c8f74f56..de36fe77 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -1571,11 +1571,12 @@ def is_nsfw():
.. versionchanged:: 1.1.0
- Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`.`
+ Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`.
+ DM channels will also now pass this check.
"""
def pred(ctx):
ch = ctx.channel
- if isinstance(ch, discord.TextChannel) and ch.is_nsfw():
+ if ctx.guild is None or (isinstance(ch, discord.TextChannel) and ch.is_nsfw()):
return True
raise NSFWChannelRequired(ch)
return check(pred)