aboutsummaryrefslogtreecommitdiff
path: root/discord/channel.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-07-18 16:36:26 -0400
committerRapptz <[email protected]>2017-07-18 16:36:26 -0400
commit6e0902ef57a5d1d4afb7581f2188e8b9e25c457d (patch)
tree78d8406e523111c677e3c30a4479958a6e8b92c5 /discord/channel.py
parentDon't re-raise in Client.connect if it's a clean close code. (diff)
downloaddiscord.py-6e0902ef57a5d1d4afb7581f2188e8b9e25c457d.tar.xz
discord.py-6e0902ef57a5d1d4afb7581f2188e8b9e25c457d.zip
Implement new-style NSFW channels.
No idea how these will change in the future but this is barebones enough for now.
Diffstat (limited to 'discord/channel.py')
-rw-r--r--discord/channel.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/discord/channel.py b/discord/channel.py
index b30c9b04..9aff327f 100644
--- a/discord/channel.py
+++ b/discord/channel.py
@@ -77,7 +77,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
top channel is position 0.
"""
- __slots__ = ( 'name', 'id', 'guild', 'topic', '_state',
+ __slots__ = ( 'name', 'id', 'guild', 'topic', '_state', 'nsfw',
'position', '_overwrites' )
def __init__(self, *, state, guild, data):
@@ -93,6 +93,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
self.name = data['name']
self.topic = data.get('topic')
self.position = data['position']
+ self.nsfw = data.get('nsfw', False)
self._fill_overwrites(data)
@asyncio.coroutine
@@ -117,7 +118,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
def is_nsfw(self):
"""Checks if the channel is NSFW."""
n = self.name
- return n == 'nsfw' or n[:5] == 'nsfw-'
+ return self.nsfw or n == 'nsfw' or n[:5] == 'nsfw-'
@asyncio.coroutine
def edit(self, *, reason=None, **options):
@@ -136,6 +137,8 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
The new channel's topic.
position: int
The new channel's position.
+ nsfw: bool
+ To mark the channel as NSFW or not.
reason: Optional[str]
The reason for editing this channel. Shows up on the audit log.