Source code for sidequest_bot.lib.forums

 1"""Finding the bot's own named posts in a forum channel, whether Discord has archived them or not."""
 2
 3from typing import Final
 4
 5import discord
 6
 7CLASS_HALLS_FORUM: Final = "class-halls"
 8"""The forum holding each class's hall, the class picker post and the gear sims post."""
 9
10INSTANCES_FORUM: Final = "dungeons-and-raids"
11"""The forum holding one post per WoW: Forever dungeon and raid."""
12
13
[docs] 14async def find_post(forum: discord.ForumChannel, name: str) -> discord.Thread | None: 15 """The post called ``name`` in ``forum``: an active one first, else an archived one, else ``None``.""" 16 post = discord.utils.get(forum.threads, name=name) 17 if post is not None: 18 return post 19 async for thread in forum.archived_threads(limit=None): 20 if thread.name == name: 21 return thread 22 return None