Browse Source

Fix Guild.by_category not showing empty categories.

pull/5069/head
Rapptz 5 years ago
parent
commit
c01bf7cd56
  1. 5
      discord/guild.py

5
discord/guild.py

@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
""" """
import copy import copy
from collections import namedtuple, defaultdict from collections import namedtuple
from . import utils from . import utils
from .role import Role from .role import Role
@ -406,9 +406,10 @@ class Guild(Hashable):
List[Tuple[Optional[:class:`CategoryChannel`], List[:class:`abc.GuildChannel`]]]: List[Tuple[Optional[:class:`CategoryChannel`], List[:class:`abc.GuildChannel`]]]:
The categories and their associated channels. The categories and their associated channels.
""" """
grouped = defaultdict(list) grouped = {}
for channel in self._channels.values(): for channel in self._channels.values():
if isinstance(channel, CategoryChannel): if isinstance(channel, CategoryChannel):
grouped[channel.id] = []
continue continue
grouped[channel.category_id].append(channel) grouped[channel.category_id].append(channel)

Loading…
Cancel
Save