From 38991027a38b1adc4be3c99d126dae76a3a62036 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Sun, 21 Jun 2020 03:09:23 +0200 Subject: Correct return when a module symbol could not be parsed. --- bot/cogs/doc.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py index a01f6d64d..1c9d80e47 100644 --- a/bot/cogs/doc.py +++ b/bot/cogs/doc.py @@ -279,7 +279,7 @@ class Doc(commands.Cog): if symbol_id == f"module-{symbol}": parsed_module = self.parse_module_symbol(symbol_heading) if parsed_module is None: - return None + return [], "" else: signatures, description = parsed_module @@ -538,14 +538,13 @@ class Doc(commands.Cog): old_inventories = set(self.base_urls) with ctx.typing(): await self.refresh_inventory() - # Get differences of added and removed inventories - added = ', '.join(inv for inv in self.base_urls if inv not in old_inventories) - if added: - added = f"+ {added}" - - removed = ', '.join(inv for inv in old_inventories if inv not in self.base_urls) - if removed: - removed = f"- {removed}" + new_inventories = set(self.base_urls) + + if added := ", ".join(new_inventories - old_inventories): + added = "+ " + added + + if removed := ", ".join(old_inventories - new_inventories): + removed = "- " + removed embed = discord.Embed( title="Inventories refreshed", -- cgit v1.2.3