aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRobin <[email protected]>2021-04-14 06:48:51 +0200
committerGitHub <[email protected]>2021-04-14 00:48:51 -0400
commit30310b9ab69e443d0f2da3334c067383a2827f87 (patch)
tree71bafb22a23b6332b5712ed794e8ae73f929ddec /discord/channel.py
parentRemove support for guild subscriptions (diff)
downloaddiscord.py-30310b9ab69e443d0f2da3334c067383a2827f87.tar.xz
discord.py-30310b9ab69e443d0f2da3334c067383a2827f87.zip
Add NSFW for Guilds
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/discord/channel.py b/discord/channel.py
index 0b8d72d7..ee6869c0 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -92,6 +92,12 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
in this channel. A value of `0` denotes that it is disabled.
Bots and users with :attr:`~Permissions.manage_channels` or
:attr:`~Permissions.manage_messages` bypass slowmode.
+ nsfw: :class:`bool`
+ If the channel is marked as "not safe for work".
+
+ .. note::
+
+ To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
"""
__slots__ = ('name', 'id', 'guild', 'topic', '_state', 'nsfw',
@@ -157,7 +163,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
def is_nsfw(self):
""":class:`bool`: Checks if the channel is NSFW."""
- return self.nsfw
+ return self.nsfw or self.guild.nsfw
def is_news(self):
""":class:`bool`: Checks if the channel is a news channel."""
@@ -886,6 +892,12 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
position: :class:`int`
The position in the category list. This is a number that starts at 0. e.g. the
top category is position 0.
+ nsfw: :class:`bool`
+ If the channel is marked as "not safe for work".
+
+ .. note::
+
+ To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
"""
__slots__ = ('name', 'id', 'guild', 'nsfw', '_state', 'position', '_overwrites', 'category_id')
@@ -917,7 +929,7 @@ class CategoryChannel(discord.abc.GuildChannel, Hashable):
def is_nsfw(self):
""":class:`bool`: Checks if the category is NSFW."""
- return self.nsfw
+ return self.nsfw or self.guild.nsfw
@utils.copy_doc(discord.abc.GuildChannel.clone)
async def clone(self, *, name=None, reason=None):
@@ -1082,6 +1094,12 @@ class StoreChannel(discord.abc.GuildChannel, Hashable):
position: :class:`int`
The position in the channel list. This is a number that starts at 0. e.g. the
top channel is position 0.
+ nsfw: :class:`bool`
+ If the channel is marked as "not safe for work".
+
+ .. note::
+
+ To check if the channel or the guild of that channel are marked as NSFW, consider :meth:`is_nsfw` instead.
"""
__slots__ = ('name', 'id', 'guild', '_state', 'nsfw',
'category_id', 'position', '_overwrites',)
@@ -1122,7 +1140,7 @@ class StoreChannel(discord.abc.GuildChannel, Hashable):
def is_nsfw(self):
""":class:`bool`: Checks if the channel is NSFW."""
- return self.nsfw
+ return self.nsfw or self.guild.nsfw
@utils.copy_doc(discord.abc.GuildChannel.clone)
async def clone(self, *, name=None, reason=None):