From d98ee567d4ad5e31fbbb9787e86b4125d8bd9431 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 13 Apr 2022 17:31:36 -0400 Subject: [PATCH] Add Guild.forums property Ran an informal poll in the official server and this name won over the alternative Guild.forum_channels property name --- discord/guild.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/discord/guild.py b/discord/guild.py index 21cbf32c4..8b26a0de2 100644 --- a/discord/guild.py +++ b/discord/guild.py @@ -632,6 +632,16 @@ class Guild(Hashable): r.sort(key=lambda c: (c.position, c.id)) return r + @property + def forums(self) -> List[ForumChannel]: + """List[:class:`ForumChannel`]: A list of forum channels that belongs to this guild. + + This is sorted by the position and are in UI order from top to bottom. + """ + r = [ch for ch in self._channels.values() if isinstance(ch, ForumChannel)] + r.sort(key=lambda c: (c.position, c.id)) + return r + def by_category(self) -> List[ByCategoryItem]: """Returns every :class:`CategoryChannel` and their associated channels.