mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-20 16:00:29 +00:00
Add support for explicit_content_filter in Guild.edit
This commit is contained in:
parent
26bb6c6ddc
commit
648e62031d
@ -750,6 +750,8 @@ class Guild(Hashable):
|
||||
The new verification level for the guild.
|
||||
default_notifications: :class:`NotificationLevel`
|
||||
The new default notification level for the guild.
|
||||
explicit_content_filter: :class:`ContentFilter`
|
||||
The new explicit content filter for the guild.
|
||||
vanity_code: str
|
||||
The new vanity code for the guild.
|
||||
system_channel: Optional[:class:`TextChannel`]
|
||||
@ -842,6 +844,11 @@ class Guild(Hashable):
|
||||
|
||||
fields['verification_level'] = level.value
|
||||
|
||||
explicit_content_filter = fields.get('explicit_content_filter', self.explicit_content_filter)
|
||||
if not isinstance(explicit_content_filter, ContentFilter):
|
||||
raise InvalidArgument('explicit_content_filter field must of type ContentFilter')
|
||||
|
||||
fields['explicit_content_filter'] = explicit_content_filter.value
|
||||
await http.edit_guild(self.id, reason=reason, **fields)
|
||||
|
||||
async def get_ban(self, user):
|
||||
|
@ -565,7 +565,8 @@ class HTTPClient:
|
||||
def edit_guild(self, guild_id, *, reason=None, **fields):
|
||||
valid_keys = ('name', 'region', 'icon', 'afk_timeout', 'owner_id',
|
||||
'afk_channel_id', 'splash', 'verification_level',
|
||||
'system_channel_id', 'default_message_notifications')
|
||||
'system_channel_id', 'default_message_notifications',
|
||||
'explicit_content_filter')
|
||||
|
||||
payload = {
|
||||
k: v for k, v in fields.items() if k in valid_keys
|
||||
@ -771,7 +772,7 @@ class HTTPClient:
|
||||
|
||||
def get_mutual_friends(self, user_id):
|
||||
return self.request(Route('GET', '/users/{user_id}/relationships', user_id=user_id))
|
||||
|
||||
|
||||
def change_hypesquad_house(self, house_id):
|
||||
payload = {'house_id': house_id}
|
||||
return self.request(Route('POST', '/hypesquad/online'), json=payload)
|
||||
|
Loading…
x
Reference in New Issue
Block a user