aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-06-29 19:41:03 -0400
committerRapptz <[email protected]>2019-06-29 19:41:38 -0400
commit2c16e43e8a98ac65e849b13bfda7f5fd36c5045b (patch)
tree36747fd7b744c56a66e8a33ca10024fbf78a5577 /discord/state.py
parent[commands] Properly raise the correct exception for owner_ids (diff)
downloaddiscord.py-2c16e43e8a98ac65e849b13bfda7f5fd36c5045b.tar.xz
discord.py-2c16e43e8a98ac65e849b13bfda7f5fd36c5045b.zip
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.
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/discord/state.py b/discord/state.py
index f2ffabb2..a974b163 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