Fix crashing for now when a category is created.
A full implementation will come later.
This commit is contained in:
parent
8912625428
commit
1367877d36
@ -249,10 +249,11 @@ class Guild(Hashable):
|
|||||||
for c in channels:
|
for c in channels:
|
||||||
if c['type'] == ChannelType.text.value:
|
if c['type'] == ChannelType.text.value:
|
||||||
channel = TextChannel(guild=self, data=c, state=self._state)
|
channel = TextChannel(guild=self, data=c, state=self._state)
|
||||||
else:
|
self._add_channel(channel)
|
||||||
|
elif c['type'] == ChannelType.voice.value:
|
||||||
channel = VoiceChannel(guild=self, data=c, state=self._state)
|
channel = VoiceChannel(guild=self, data=c, state=self._state)
|
||||||
|
self._add_channel(channel)
|
||||||
|
|
||||||
self._add_channel(channel)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def channels(self):
|
def channels(self):
|
||||||
|
@ -496,6 +496,10 @@ class ConnectionState:
|
|||||||
guild_id = utils._get_as_snowflake(data, 'guild_id')
|
guild_id = utils._get_as_snowflake(data, 'guild_id')
|
||||||
guild = self._get_guild(guild_id)
|
guild = self._get_guild(guild_id)
|
||||||
if guild is not None:
|
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)
|
channel = factory(guild=guild, state=self, data=data)
|
||||||
guild._add_channel(channel)
|
guild._add_channel(channel)
|
||||||
self.dispatch('guild_channel_create', channel)
|
self.dispatch('guild_channel_create', channel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user