aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-04-12 20:18:28 -0400
committerRapptz <[email protected]>2017-04-12 20:18:28 -0400
commit728fae928563057785be34324b13a5f3ffc9b83e (patch)
treed4a43cca62bf7b4d978ff55aa2d84da830312d5b
parentUse create_future wrapper for initially created Future. (diff)
downloaddiscord.py-728fae928563057785be34324b13a5f3ffc9b83e.tar.xz
discord.py-728fae928563057785be34324b13a5f3ffc9b83e.zip
Add Guild.explicit_content_filter.
-rw-r--r--discord/enums.py8
-rw-r--r--discord/guild.py8
-rw-r--r--docs/api.rst16
3 files changed, 30 insertions, 2 deletions
diff --git a/discord/enums.py b/discord/enums.py
index 366aca58..e91d592b 100644
--- a/discord/enums.py
+++ b/discord/enums.py
@@ -74,6 +74,14 @@ class VerificationLevel(Enum):
def __str__(self):
return self.name
+class ContentFilter(Enum):
+ disabled = 0
+ no_role = 1
+ all_members = 2
+
+ def __str__(self):
+ return self.name
+
class Status(Enum):
online = 'online'
offline = 'offline'
diff --git a/discord/guild.py b/discord/guild.py
index 021648d6..0c218c26 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -38,7 +38,7 @@ from .permissions import PermissionOverwrite
from .colour import Colour
from .errors import InvalidArgument, ClientException
from .channel import *
-from .enums import GuildRegion, Status, ChannelType, try_enum, VerificationLevel
+from .enums import GuildRegion, Status, ChannelType, try_enum, VerificationLevel, ContentFilter
from .mixins import Hashable
from .user import User
from .invite import Invite
@@ -97,6 +97,8 @@ class Guild(Hashable):
1 then they do.
verification_level: :class:`VerificationLevel`
The guild's verification level.
+ explicit_content_filter: :class:`ContentFilter`
+ The guild's explicit content filter.
features: List[str]
A list of features that the guild has. They are currently as follows:
@@ -112,7 +114,8 @@ class Guild(Hashable):
'name', 'id', 'unavailable', 'name', 'region', '_state',
'_default_role', 'roles', '_member_count', '_large',
'owner_id', 'mfa_level', 'emojis', 'features',
- 'verification_level', 'splash', '_voice_states' )
+ 'verification_level', 'explicit_content_filter', 'splash',
+ '_voice_states' )
def __init__(self, *, data, state):
self._channels = {}
@@ -194,6 +197,7 @@ class Guild(Hashable):
self.name = guild.get('name')
self.region = try_enum(GuildRegion, guild.get('region'))
self.verification_level = try_enum(VerificationLevel, guild.get('verification_level'))
+ self.explicit_content_filter = try_enum(ContentFilter, guild.get('explicit_content_filter', 0))
self.afk_timeout = guild.get('afk_timeout')
self.icon = guild.get('icon')
self.unavailable = guild.get('unavailable', False)
diff --git a/docs/api.rst b/docs/api.rst
index 6581cc97..09f5be77 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -633,6 +633,22 @@ All enumerations are subclasses of `enum`_.
An alias for :attr:`high`.
+.. class:: ContentFilter
+
+ Specifies a :class:`Guild`\'s explicit content filter, which is the machine
+ learning algorithms that Discord uses to detect if an image contains
+ pornography or otherwise explicit content.
+
+ .. attribute:: disabled
+
+ The guild does not have the content filter enabled.
+ .. attribute:: no_role
+
+ The guild has the content filter enabled for members without a role.
+ .. attribute:: all_members
+
+ The guild has the content filter enabled for every member.
+
.. class:: Status
Specifies a :class:`Member` 's status.