Add Guild.explicit_content_filter.
This commit is contained in:
parent
cadf6960b7
commit
728fae9285
@ -74,6 +74,14 @@ class VerificationLevel(Enum):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
class ContentFilter(Enum):
|
||||||
|
disabled = 0
|
||||||
|
no_role = 1
|
||||||
|
all_members = 2
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
class Status(Enum):
|
class Status(Enum):
|
||||||
online = 'online'
|
online = 'online'
|
||||||
offline = 'offline'
|
offline = 'offline'
|
||||||
|
@ -38,7 +38,7 @@ from .permissions import PermissionOverwrite
|
|||||||
from .colour import Colour
|
from .colour import Colour
|
||||||
from .errors import InvalidArgument, ClientException
|
from .errors import InvalidArgument, ClientException
|
||||||
from .channel import *
|
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 .mixins import Hashable
|
||||||
from .user import User
|
from .user import User
|
||||||
from .invite import Invite
|
from .invite import Invite
|
||||||
@ -97,6 +97,8 @@ class Guild(Hashable):
|
|||||||
1 then they do.
|
1 then they do.
|
||||||
verification_level: :class:`VerificationLevel`
|
verification_level: :class:`VerificationLevel`
|
||||||
The guild's verification level.
|
The guild's verification level.
|
||||||
|
explicit_content_filter: :class:`ContentFilter`
|
||||||
|
The guild's explicit content filter.
|
||||||
features: List[str]
|
features: List[str]
|
||||||
A list of features that the guild has. They are currently as follows:
|
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',
|
'name', 'id', 'unavailable', 'name', 'region', '_state',
|
||||||
'_default_role', 'roles', '_member_count', '_large',
|
'_default_role', 'roles', '_member_count', '_large',
|
||||||
'owner_id', 'mfa_level', 'emojis', 'features',
|
'owner_id', 'mfa_level', 'emojis', 'features',
|
||||||
'verification_level', 'splash', '_voice_states' )
|
'verification_level', 'explicit_content_filter', 'splash',
|
||||||
|
'_voice_states' )
|
||||||
|
|
||||||
def __init__(self, *, data, state):
|
def __init__(self, *, data, state):
|
||||||
self._channels = {}
|
self._channels = {}
|
||||||
@ -194,6 +197,7 @@ class Guild(Hashable):
|
|||||||
self.name = guild.get('name')
|
self.name = guild.get('name')
|
||||||
self.region = try_enum(GuildRegion, guild.get('region'))
|
self.region = try_enum(GuildRegion, guild.get('region'))
|
||||||
self.verification_level = try_enum(VerificationLevel, guild.get('verification_level'))
|
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.afk_timeout = guild.get('afk_timeout')
|
||||||
self.icon = guild.get('icon')
|
self.icon = guild.get('icon')
|
||||||
self.unavailable = guild.get('unavailable', False)
|
self.unavailable = guild.get('unavailable', False)
|
||||||
|
16
docs/api.rst
16
docs/api.rst
@ -633,6 +633,22 @@ All enumerations are subclasses of `enum`_.
|
|||||||
|
|
||||||
An alias for :attr:`high`.
|
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
|
.. class:: Status
|
||||||
|
|
||||||
Specifies a :class:`Member` 's status.
|
Specifies a :class:`Member` 's status.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user