From 2c16e43e8a98ac65e849b13bfda7f5fd36c5045b Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 29 Jun 2019 19:41:03 -0400 Subject: [PATCH] Fix regression with unresolved channels due to reordering. Channels are meant to fallback to Object if the message is out of order. Somewhere along the commit line this got removed despite the issue still existing. --- discord/state.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/discord/state.py b/discord/state.py index f2ffabb2d..a974b163a 100644 --- a/discord/state.py +++ b/discord/state.py @@ -47,6 +47,7 @@ from .role import Role from .enums import ChannelType, try_enum, Status, Enum from . import utils from .embeds import Embed +from .object import Object class ListenerType(Enum): chunk = 0 @@ -260,15 +261,16 @@ class ConnectionState: yield self.receive_chunk(guild.id) def _get_guild_channel(self, data): + channel_id = int(data['channel_id']) try: guild = self._get_guild(int(data['guild_id'])) except KeyError: - channel = self.get_channel(int(data['channel_id'])) + channel = self.get_channel(channel_id) guild = None else: - channel = guild and guild.get_channel(int(data['channel_id'])) + channel = guild and guild.get_channel(channel_id) - return channel, guild + return channel or Object(id=channel_id), guild async def request_offline_members(self, guilds): # get all the chunks