aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-06-21 03:09:23 +0200
committerGravatar Numerlor <[email protected]>2020-06-21 03:09:23 +0200
commit38991027a38b1adc4be3c99d126dae76a3a62036 (patch)
treee337007d002c17eff0664f1c41695e7a19fc36f7
parentFix typehint. (diff)
Correct return when a module symbol could not be parsed.
-rw-r--r--bot/cogs/doc.py17
1 files 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",