Add Guild.default_notifications
This commit is contained in:
parent
016963500b
commit
1ac432d9f0
@ -29,7 +29,7 @@ from enum import Enum, IntEnum
|
|||||||
__all__ = ['ChannelType', 'MessageType', 'VoiceRegion', 'VerificationLevel',
|
__all__ = ['ChannelType', 'MessageType', 'VoiceRegion', 'VerificationLevel',
|
||||||
'ContentFilter', 'Status', 'DefaultAvatar', 'RelationshipType',
|
'ContentFilter', 'Status', 'DefaultAvatar', 'RelationshipType',
|
||||||
'AuditLogAction', 'AuditLogActionCategory', 'UserFlags',
|
'AuditLogAction', 'AuditLogActionCategory', 'UserFlags',
|
||||||
'ActivityType', 'HypeSquadHouse']
|
'ActivityType', 'HypeSquadHouse', 'NotificationLevel']
|
||||||
|
|
||||||
class ChannelType(Enum):
|
class ChannelType(Enum):
|
||||||
text = 0
|
text = 0
|
||||||
@ -123,6 +123,10 @@ class RelationshipType(Enum):
|
|||||||
incoming_request = 3
|
incoming_request = 3
|
||||||
outgoing_request = 4
|
outgoing_request = 4
|
||||||
|
|
||||||
|
class NotificationLevel(Enum):
|
||||||
|
all_messages = 0
|
||||||
|
only_mentions = 1
|
||||||
|
|
||||||
class AuditLogActionCategory(Enum):
|
class AuditLogActionCategory(Enum):
|
||||||
create = 1
|
create = 1
|
||||||
delete = 2
|
delete = 2
|
||||||
|
@ -35,7 +35,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 VoiceRegion, Status, ChannelType, try_enum, VerificationLevel, ContentFilter
|
from .enums import VoiceRegion, Status, ChannelType, try_enum, VerificationLevel, ContentFilter, NotificationLevel
|
||||||
from .mixins import Hashable
|
from .mixins import Hashable
|
||||||
from .utils import valid_icon_size
|
from .utils import valid_icon_size
|
||||||
from .user import User
|
from .user import User
|
||||||
@ -103,6 +103,8 @@ class Guild(Hashable):
|
|||||||
The guild's verification level.
|
The guild's verification level.
|
||||||
explicit_content_filter: :class:`ContentFilter`
|
explicit_content_filter: :class:`ContentFilter`
|
||||||
The guild's explicit content filter.
|
The guild's explicit content filter.
|
||||||
|
default_notifications: :class:`NotificationLevel`
|
||||||
|
The guild's notification settings.
|
||||||
features: List[:class:`str`]
|
features: List[:class:`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:
|
||||||
|
|
||||||
@ -121,7 +123,7 @@ class Guild(Hashable):
|
|||||||
'_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', 'explicit_content_filter', 'splash',
|
'verification_level', 'explicit_content_filter', 'splash',
|
||||||
'_voice_states', '_system_channel_id', )
|
'_voice_states', '_system_channel_id', 'default_notifications')
|
||||||
|
|
||||||
def __init__(self, *, data, state):
|
def __init__(self, *, data, state):
|
||||||
self._channels = {}
|
self._channels = {}
|
||||||
@ -205,6 +207,7 @@ class Guild(Hashable):
|
|||||||
self.name = guild.get('name')
|
self.name = guild.get('name')
|
||||||
self.region = try_enum(VoiceRegion, guild.get('region'))
|
self.region = try_enum(VoiceRegion, guild.get('region'))
|
||||||
self.verification_level = try_enum(VerificationLevel, guild.get('verification_level'))
|
self.verification_level = try_enum(VerificationLevel, guild.get('verification_level'))
|
||||||
|
self.default_notifications = try_enum(NotificationLevel, guild.get('default_message_notifications'))
|
||||||
self.explicit_content_filter = try_enum(ContentFilter, guild.get('explicit_content_filter', 0))
|
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')
|
||||||
|
11
docs/api.rst
11
docs/api.rst
@ -852,6 +852,17 @@ All enumerations are subclasses of `enum`_.
|
|||||||
|
|
||||||
An alias for :attr:`extreme`.
|
An alias for :attr:`extreme`.
|
||||||
|
|
||||||
|
.. class:: NotificationLevel
|
||||||
|
|
||||||
|
Specifies whether a :class:`Guild` has notifications on for all messages or mentions only by default.
|
||||||
|
|
||||||
|
..attribute:: all_messages
|
||||||
|
|
||||||
|
Members receive notifications for every message regardless of them being mentioned.
|
||||||
|
..attribute:: only_mentions
|
||||||
|
|
||||||
|
Members receive notifications for messages they are mentioned in.
|
||||||
|
|
||||||
.. class:: ContentFilter
|
.. class:: ContentFilter
|
||||||
|
|
||||||
Specifies a :class:`Guild`\'s explicit content filter, which is the machine
|
Specifies a :class:`Guild`\'s explicit content filter, which is the machine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user