diff options
| -rw-r--r-- | bot/exts/help_channels/_channel.py | 10 | ||||
| -rw-r--r-- | bot/exts/help_channels/_cog.py | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index 986d3f28b..029f55217 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -25,7 +25,7 @@ def get_category_channels(category: discord.CategoryChannel) -> t.Iterable[disco yield channel -async def get_closing_time(channel: discord.TextChannel) -> t.Tuple[datetime, str]: +async def get_closing_time(channel: discord.TextChannel, init_done: bool) -> t.Tuple[datetime, str]: """Return the timestamp at which the given help `channel` should be closed along with the reason.""" log.trace(f"Getting the closing time for #{channel} ({channel.id}).") @@ -39,8 +39,12 @@ async def get_closing_time(channel: discord.TextChannel) -> t.Tuple[datetime, st non_claimant_last_message_time = await _caches.non_claimant_last_message_times.get(channel.id) claimant_last_message_time = await _caches.claimant_last_message_times.get(channel.id) - if is_empty or not (non_claimant_last_message_time and claimant_last_message_time): - # Current help session has no messages, or at least one of the caches is empty. + if is_empty or not all( + init_done, + non_claimant_last_message_time, + claimant_last_message_time, + ): + # Current help channel has no messages, at least one of the caches is empty or the help system cog is starting. # Use the last message in the channel to determine closing time instead. msg = await _message.get_last_message(channel) diff --git a/bot/exts/help_channels/_cog.py b/bot/exts/help_channels/_cog.py index af106e92f..78ef8e89f 100644 --- a/bot/exts/help_channels/_cog.py +++ b/bot/exts/help_channels/_cog.py @@ -298,8 +298,7 @@ class HelpChannels(commands.Cog): dormant will first be cancelled. """ log.trace(f"Handling in-use channel #{channel} ({channel.id}).") - - closing_time, closed_on = await _channel.get_closing_time(channel) + closing_time, closed_on = await _channel.get_closing_time(channel, self.init_task.done()) # The time at which the channel should be closed, based on messages sent. if closing_time < datetime.utcnow(): |