diff options
| author | 2021-03-25 22:39:17 +0000 | |
|---|---|---|
| committer | 2021-03-25 22:39:17 +0000 | |
| commit | d7eb48aef4035494d078e489fd926be4eae48e64 (patch) | |
| tree | df07f9cc6499a0463d42e25c33af581235d38bec | |
| parent | Refactor help channel update message cache function for clearer flow (diff) | |
Refactor if block within help channel system to be more readable
| -rw-r--r-- | bot/exts/help_channels/_channel.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bot/exts/help_channels/_channel.py b/bot/exts/help_channels/_channel.py index 76cce1249..9497cb4fb 100644 --- a/bot/exts/help_channels/_channel.py +++ b/bot/exts/help_channels/_channel.py @@ -39,13 +39,14 @@ async def get_closing_time(channel: discord.TextChannel, init_done: bool) -> t.T 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 all( - init_done, - non_claimant_last_message_time, - claimant_last_message_time, + if ( + is_empty + or not init_done + or non_claimant_last_message_time is None + or claimant_last_message_time is None ): - # 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. + # if the current help channel has no messages, the help system cog is starting or + # at least one of the caches is empty use the last message in the channel to determine closing time instead. msg = await _message.get_last_message(channel) |