diff options
| author | Rapptz <[email protected]> | 2019-03-17 14:32:51 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-03-17 14:32:51 -0400 |
| commit | 5061915b2ab032ca0c56fd27fad81dd4bd795679 (patch) | |
| tree | ee809c46b59468e676aaa3f725b65d7edd7ef723 /discord/guild.py | |
| parent | Fix NameError in Embed.to_dict (diff) | |
| download | discord.py-5061915b2ab032ca0c56fd27fad81dd4bd795679.tar.xz discord.py-5061915b2ab032ca0c56fd27fad81dd4bd795679.zip | |
Add support for store channels.
Diffstat (limited to 'discord/guild.py')
| -rw-r--r-- | discord/guild.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/discord/guild.py b/discord/guild.py index 52199e52..5ccf293c 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -261,13 +261,15 @@ class Guild(Hashable): if 'channels' in data: channels = data['channels'] for c in channels: - if c['type'] == ChannelType.text.value or c['type'] == ChannelType.news.value: + c_type = c['type'] + if c_type in (ChannelType.text.value, ChannelType.news.value): self._add_channel(TextChannel(guild=self, data=c, state=self._state)) - elif c['type'] == ChannelType.voice.value: + elif c_type == ChannelType.voice.value: self._add_channel(VoiceChannel(guild=self, data=c, state=self._state)) - elif c['type'] == ChannelType.category.value: + elif c_type == ChannelType.category.value: self._add_channel(CategoryChannel(guild=self, data=c, state=self._state)) - + elif c_type == ChannelType.store.value: + self._add_channel(StoreChannel(guild=self, data=c, state=self._state)) @property def channels(self): @@ -359,7 +361,7 @@ class Guild(Hashable): as_list = [(_get(k), v) for k, v in grouped.items()] as_list.sort(key=key) for _, channels in as_list: - channels.sort(key=lambda c: (not isinstance(c, TextChannel), c.position, c.id)) + channels.sort(key=lambda c: (c._sorting_bucket, c.position, c.id)) return as_list def get_channel(self, channel_id): |