From 6302ef80949ac409e92ce2db455c2034fe400ab8 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 17 Dec 2016 13:34:19 -0500 Subject: Add support for partnered servers. Fixes #387. This commit allows you to edit a server's invite splash, query if something has partnered features, and retrieve the invite splash + URL. --- discord/client.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'discord/client.py') diff --git a/discord/client.py b/discord/client.py index 948b5b92..8cfe48ef 100644 --- a/discord/client.py +++ b/discord/client.py @@ -2290,20 +2290,25 @@ class Client: Parameters ---------- - server : :class:`Server` + server: :class:`Server` The server to edit. - name : str + name: str The new name of the server. - icon : bytes + icon: bytes A *bytes-like* object representing the icon. See :meth:`edit_profile` - for more details. Could be ``None`` to denote - region : :class:`ServerRegion` + for more details. Could be ``None`` to denote no icon. + splash: bytes + A *bytes-like* object representing the invite splash. See + :meth:`edit_profile` for more details. Could be ``None`` to denote + no invite splash. Only available for partnered servers with + ``INVITE_SPLASH`` feature. + region: :class:`ServerRegion` The new region for the server's voice communication. - afk_channel : :class:`Channel` + afk_channel: :class:`Channel` The new channel that is the AFK channel. Could be ``None`` for no AFK channel. - afk_timeout : int + afk_timeout: int The number of seconds until someone is moved to the AFK channel. - owner : :class:`Member` + owner: :class:`Member` The new owner of the server to transfer ownership to. Note that you must be owner of the server to do this. verification_level: :class:`VerificationLevel` @@ -2333,7 +2338,18 @@ class Client: else: icon = None + try: + splash_bytes = fields['splash'] + except KeyError: + splash = server.splash + else: + if splash_bytes is not None: + splash = utils._bytes_to_base64_data(splash_bytes) + else: + splash = None + fields['icon'] = icon + fields['splash'] = splash if 'afk_channel' in fields: fields['afk_channel_id'] = fields['afk_channel'].id -- cgit v1.2.3