Browse Source

Fix bug with Guild.by_category not showing some channels

If categories come after a child channel in the dictionary mapping for
whatever reason, then the previous code would remove it from the
mapping and set it to []. This commit aims to fix this.
v1.4.x
Rapptz 5 years ago
parent
commit
40de807c16
  1. 2
      discord/guild.py

2
discord/guild.py

@ -415,7 +415,7 @@ class Guild(Hashable):
grouped = {} grouped = {}
for channel in self._channels.values(): for channel in self._channels.values():
if isinstance(channel, CategoryChannel): if isinstance(channel, CategoryChannel):
grouped[channel.id] = [] grouped.setdefault(channel.id, [])
continue continue
try: try:

Loading…
Cancel
Save