aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-06-27 05:27:47 -0400
committerRapptz <[email protected]>2020-06-27 05:27:47 -0400
commitf94b00cb48f3763dc3119d28717567ea6dc9e131 (patch)
tree37c61dfcc1e5924cba11098a624adb5aa7f0d3ff
parentFix Guild.by_category not showing empty categories. (diff)
downloaddiscord.py-f94b00cb48f3763dc3119d28717567ea6dc9e131.tar.xz
discord.py-f94b00cb48f3763dc3119d28717567ea6dc9e131.zip
Fix a KeyError for channels with no category in Guild.by_category
-rw-r--r--discord/guild.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/guild.py b/discord/guild.py
index b675150f..7e24b4b4 100644
--- a/discord/guild.py
+++ b/discord/guild.py
@@ -412,7 +412,10 @@ class Guild(Hashable):
grouped[channel.id] = []
continue
- grouped[channel.category_id].append(channel)
+ try:
+ grouped[channel.category_id].append(channel)
+ except KeyError:
+ grouped[channel.category_id] = [channel]
def key(t):
k, v = t