aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-08-15 18:41:44 -0700
committerGravatar MarkKoz <[email protected]>2021-08-15 18:58:13 -0700
commit8731b19ef771b18bad6418ebb3699b6a3550c60b (patch)
tree9e5e29b5f9bf2b5aa7c36e7118fb4e1c5657556f
parentMerge pull request #1677 from python-discord/mbaruh/jam-management (diff)
HelpChannels: fix incomplete init of available channel set
If the cog is reloaded while there are less than the maximum amount of available channels, it makes some channels available until the limit is reached. When a channel is made available, it updates the `available_help_channels` set. The `update_available_help_channels()` function would not update this set if it saw that the set already contains elements. This resulted in only the channels that were just made available being in the set; the set would not contain the channels that were already available when the bot started. Fix this by unconditionally populating the set, but moving it to `init_available()` so it only happens once. Fix BOT-Z1 Fix #1715
-rw-r--r--bot/exts/help_channels/_cog.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py
index afaf9b0bd..34fae7248 100644
--- a/bot/exts/help_channels/_cog.py
+++ b/bot/exts/help_channels/_cog.py
@@ -267,6 +267,10 @@ class HelpChannels(commands.Cog):
for channel in channels[:abs(missing)]:
await self.unclaim_channel(channel, closed_on=_channel.ClosingReason.CLEANUP)
+ self.available_help_channels = {
+ c for c in self.available_category.channels if not _channel.is_excluded_channel(c)
+ }
+
# Getting channels that need to be included in the dynamic message.
await self.update_available_help_channels()
log.trace("Dynamic available help message updated.")
@@ -519,11 +523,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"))