From c01bf7cd564314903c89eb2add4e3271fbef5e69 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 27 Jun 2020 04:06:49 -0400 Subject: [PATCH] Fix Guild.by_category not showing empty categories. --- discord/guild.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/guild.py b/discord/guild.py index 19cb1cc02..b675150f9 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. """ import copy -from collections import namedtuple, defaultdict +from collections import namedtuple from . import utils from .role import Role @@ -406,9 +406,10 @@ class Guild(Hashable): List[Tuple[Optional[:class:`CategoryChannel`], List[:class:`abc.GuildChannel`]]]: The categories and their associated channels. """ - grouped = defaultdict(list) + grouped = {} for channel in self._channels.values(): if isinstance(channel, CategoryChannel): + grouped[channel.id] = [] continue grouped[channel.category_id].append(channel)