aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-28 19:07:56 -0400
committerRapptz <[email protected]>2016-06-28 19:07:56 -0400
commitd87d11c5a66a0b2684fe606d0bbbe14e74fcc46d (patch)
tree7913ed8c4c6bf6539502c77d4c72629b14b61eb0 /discord/state.py
parentChange max_length to max_messages (diff)
downloaddiscord.py-d87d11c5a66a0b2684fe606d0bbbe14e74fcc46d.tar.xz
discord.py-d87d11c5a66a0b2684fe606d0bbbe14e74fcc46d.zip
Fix voice states being overwritten after a GUILD_SYNC.
This was a two-fold problem. The first of which involved the overwriting of members during a GUILD_SYNC. Since we are requesting a chunk anyway, we have all the member references we need without actually chunking. The second problem came from the order. We were doing a GUILD_SYNC and then doing the chunking requests. We should do the GUILD_SYNC after the chunking in order to just update presences.
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/discord/state.py b/discord/state.py
index 02ee04f1..7fc8debc 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -186,6 +186,10 @@ class ConnectionState:
# remove the state
del self._ready_state
+ # call GUILD_SYNC after we're done chunking
+ if not self.is_bot:
+ compat.create_task(self.syncer([s.id for s in self.servers]), loop=self.loop)
+
# dispatch the event
self.dispatch('ready')
@@ -200,9 +204,6 @@ class ConnectionState:
if server.large or not self.is_bot:
servers.append(server)
- if not self.is_bot:
- compat.create_task(self.syncer([s.id for s in self.servers]), loop=self.loop)
-
for pm in data.get('private_channels'):
self._add_private_channel(PrivateChannel(id=pm['id'],
user=User(**pm['recipient'])))