aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mark <[email protected]>2021-08-16 22:07:12 -0700
committerGravatar GitHub <[email protected]>2021-08-16 22:07:12 -0700
commit5a7256fe0852cc19aeeb7a8b57c73bfba2fd2ace (patch)
treeb8f8bea57d0ddf7a6ba48bb0e079c61bfcc67872
parentMerge pull request #1753 from D0rs4n/pr/deletewebhook (diff)
parentMerge branch 'main' into bug/help/1715/avail-set-init (diff)
Merge #1752 - help channels: fix initialisation of available channels set
-rw-r--r--bot/exts/help_channels/_cog.py14
-rw-r--r--bot/exts/help_channels/_message.py8
2 files changed, 8 insertions, 14 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index afaf9b0bd..cfc9cf477 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -267,6 +267,8 @@ class HelpChannels(commands.Cog):
for channel in channels[:abs(missing)]:
await self.unclaim_channel(channel, closed_on=_channel.ClosingReason.CLEANUP)
+ self.available_help_channels = set(_channel.get_category_channels(self.available_category))
+
# Getting channels that need to be included in the dynamic message.
await self.update_available_help_channels()
log.trace("Dynamic available help message updated.")
@@ -387,13 +389,10 @@ class HelpChannels(commands.Cog):
)
log.trace(f"Sending dormant message for #{channel} ({channel.id}).")
- dormant_category = await channel_utils.try_get_channel(constants.Categories.help_dormant)
- available_category = await channel_utils.try_get_channel(constants.Categories.help_available)
embed = discord.Embed(
description=_message.DORMANT_MSG.format(
- dormant=dormant_category.name,
- available=available_category.name,
- asking_guide=_message.ASKING_GUIDE_URL
+ dormant=self.dormant_category.name,
+ available=self.available_category.name,
)
)
await channel.send(embed=embed)
@@ -519,11 +518,6 @@ class HelpChannels(commands.Cog):
async def update_available_help_channels(self) -> None:
"""Updates the dynamic message within #how-to-get-help for available help channels."""
- if not self.available_help_channels:
- self.available_help_channels = set(
- c for c in self.available_category.channels if not _channel.is_excluded_channel(c)
- )
-
available_channels = AVAILABLE_HELP_CHANNELS.format(
available=", ".join(
c.mention for c in sorted(self.available_help_channels, key=attrgetter("position"))
diff --git a/bot/exts/help_channels/_message.py b/bot/exts/help_channels/_message.py
index cf070be83..077b20b47 100644
--- a/bot/exts/help_channels/_message.py
+++ b/bot/exts/help_channels/_message.py
@@ -29,15 +29,15 @@ AVAILABLE_TITLE = "Available help channel"
AVAILABLE_FOOTER = "Closes after a period of inactivity, or when you send !close."
-DORMANT_MSG = """
-This help channel has been marked as **dormant**, and has been moved into the **{dormant}** \
+DORMANT_MSG = f"""
+This help channel has been marked as **dormant**, and has been moved into the **{{dormant}}** \
category at the bottom of the channel list. It is no longer possible to send messages in this \
channel until it becomes available again.
If your question wasn't answered yet, you can claim a new help channel from the \
-**{available}** category by simply asking your question again. Consider rephrasing the \
+**{{available}}** category by simply asking your question again. Consider rephrasing the \
question to maximize your chance of getting a good answer. If you're not sure how, have a look \
-through our guide for **[asking a good question]({asking_guide})**.
+through our guide for **[asking a good question]({ASKING_GUIDE_URL})**.
"""