aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-05-22 11:20:46 -0700
committerGravatar MarkKoz <[email protected]>2020-05-22 11:32:01 -0700
commite8266b8e1029f31dea3ad6ecbe36b7df56b8acdc (patch)
tree915329cecf4685252e55cd7c059b1b4f0a8d251a
parentHelpChannels: rename `embed_description_match` (diff)
HelpChannels: move message None check inside `match_bot_embed`
It was being done repeatedly outside the function so let's move it in to reduce redundancy.
-rw-r--r--bot/cogs/help_channels.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py
index b9b577256..07acff34d 100644
--- a/bot/cogs/help_channels.py
+++ b/bot/cogs/help_channels.py
@@ -440,14 +440,11 @@ class HelpChannels(Scheduler, commands.Cog):
def is_dormant_message(self, message: t.Optional[discord.Message]) -> bool:
"""Return True if the contents of the `message` match `DORMANT_MSG`."""
- if not message:
- return False
-
return self.match_bot_embed(message, DORMANT_MSG)
- def match_bot_embed(self, message: discord.Message, description: str) -> bool:
+ def match_bot_embed(self, message: t.Optional[discord.Message], description: str) -> bool:
"""Return `True` if the bot's `message`'s embed description matches `description`."""
- if not message.embeds:
+ if not message or not message.embeds:
return False
embed = message.embeds[0]
@@ -748,9 +745,6 @@ class HelpChannels(Scheduler, commands.Cog):
async def is_empty(self, channel: discord.TextChannel) -> bool:
"""Return True if the most recent message in `channel` is the bot's `AVAILABLE_MSG`."""
msg = await self.get_last_message(channel)
- if not msg:
- return False
-
return self.match_bot_embed(msg, AVAILABLE_MSG)
async def reset_send_permissions(self) -> None: