diff options
| author | Rapptz <[email protected]> | 2017-04-26 21:02:30 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-04-26 21:02:30 -0400 |
| commit | d3a86a5fb6dd42d9fc2ab5eb44de5bc750563119 (patch) | |
| tree | b07f6d8b892996bf7b3397577d1c968e7fd34a9a | |
| parent | Don't set VoiceClient.channel to None when VOICE_STATE_UPDATE says so. (diff) | |
| download | discord.py-d3a86a5fb6dd42d9fc2ab5eb44de5bc750563119.tar.xz discord.py-d3a86a5fb6dd42d9fc2ab5eb44de5bc750563119.zip | |
Add TextChannel.is_nsfw method to check for NSFW channels.
| -rw-r--r-- | discord/channel.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/channel.py b/discord/channel.py index 058f1d39..d674d5b7 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -110,6 +110,11 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): """Returns a list of :class:`Member` that can see this channel.""" return [m for m in self.guild.members if self.permissions_for(m).read_messages] + def is_nsfw(self): + """Checks if the channel is NSFW.""" + n = self.name + return n == 'nsfw' if len(n) < 5 else n[:5] == 'nsfw-' + @asyncio.coroutine def edit(self, **options): """|coro| |