From 11f29890dcb41b064b8fca925e319919628efc1b Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 22 Aug 2020 17:18:13 -0400 Subject: [PATCH] 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. --- discord/guild.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/discord/guild.py b/discord/guild.py index ce32bfc9e..0c6585d02 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -104,10 +104,10 @@ class Guild(Hashable): max_presences: Optional[:class:`int`] The maximum amount of presences for the guild. max_members: Optional[:class:`int`] - The maximum amount of members for the guild. + The maximum amount of members for the guild. .. note:: - + This attribute is only available via :meth:`.Client.fetch_guild`. max_video_channel_users: Optional[:class:`int`] The maximum amount of users in a video channel. @@ -415,7 +415,7 @@ class Guild(Hashable): grouped = {} for channel in self._channels.values(): if isinstance(channel, CategoryChannel): - grouped[channel.id] = [] + grouped.setdefault(channel.id, []) continue try: @@ -909,7 +909,7 @@ class Guild(Hashable): The channel's preferred audio bitrate in bits per second. user_limit: :class:`int` The channel's limit for number of members that can be in a voice channel. - + Raises ------ Forbidden @@ -940,7 +940,7 @@ class Guild(Hashable): The ``category`` parameter is not supported in this function since categories cannot have categories. - + Raises ------ Forbidden @@ -1746,7 +1746,7 @@ class Guild(Hashable): async def edit_role_positions(self, positions, *, reason=None): """|coro| - + Bulk edits a list of :class:`Role` in the guild. You must have the :attr:`~Permissions.manage_roles` permission to