aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-06-19 04:25:05 -0400
committerRapptz <[email protected]>2017-06-19 04:25:05 -0400
commit7b806667cda6dc26b6a99d73473dcff5c2dd4044 (patch)
tree703cfd2784bd47dfe23022f1cab00d5cee9db238
parentDocumentation fix. (diff)
downloaddiscord.py-7b806667cda6dc26b6a99d73473dcff5c2dd4044.tar.xz
discord.py-7b806667cda6dc26b6a99d73473dcff5c2dd4044.zip
Fix afk_channel being None in Client.edit_server
-rw-r--r--discord/client.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/discord/client.py b/discord/client.py
index c6d1e59d..51e2332f 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -2307,7 +2307,7 @@ class Client:
``INVITE_SPLASH`` feature.
region: :class:`ServerRegion`
The new region for the server's voice communication.
- afk_channel: :class:`Channel`
+ afk_channel: Optional[:class:`Channel`]
The new channel that is the AFK channel. Could be ``None`` for no AFK channel.
afk_timeout: int
The number of seconds until someone is moved to the AFK channel.
@@ -2353,8 +2353,16 @@ class Client:
fields['icon'] = icon
fields['splash'] = splash
- if 'afk_channel' in fields:
- fields['afk_channel_id'] = fields['afk_channel'].id
+
+ try:
+ afk_channel = fields.pop('afk_channel')
+ except KeyError:
+ pass
+ else:
+ if afk_channel is None:
+ fields['afk_channel_id'] = afk_channel
+ else:
+ fields['afk_channel_id'] = afk_channel.id
if 'owner' in fields:
if server.owner != server.me: