[commands] DM channels are NSFW in commands.is_nsfw check.
This commit is contained in:
parent
919dbcafb3
commit
188bd4e708
@ -1571,11 +1571,12 @@ def is_nsfw():
|
|||||||
|
|
||||||
.. versionchanged:: 1.1.0
|
.. 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):
|
def pred(ctx):
|
||||||
ch = ctx.channel
|
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
|
return True
|
||||||
raise NSFWChannelRequired(ch)
|
raise NSFWChannelRequired(ch)
|
||||||
return check(pred)
|
return check(pred)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user