aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/state.py b/discord/state.py
index 0511b754..c470d11c 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -496,6 +496,10 @@ class ConnectionState:
guild_id = utils._get_as_snowflake(data, 'guild_id')
guild = self._get_guild(guild_id)
if guild is not None:
+ if factory is None:
+ log.warning('CHANNEL_CREATE referencing an unknown channel type %s. Discarding.', data['type'])
+ return
+
channel = factory(guild=guild, state=self, data=data)
guild._add_channel(channel)
self.dispatch('guild_channel_create', channel)