aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2021-01-11 02:42:19 +0100
committerGravatar Numerlor <[email protected]>2021-01-11 02:42:19 +0100
commitf5235b16343816b02ceef56d1e753cb0167c6b03 (patch)
tree5e958b384dd00cba3d96a41181669427cccd3a80
parentNotify the user that inventories were refreshed on cache clears (diff)
Check for containment instead of always getting the value from the dict
Getting the value from a defaultdict will always create the key for it, creating unnecessary entries every time a symbol is fetched from the bot
-rw-r--r--bot/exts/info/doc/_cog.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index 822c984d7..b35469787 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -267,8 +267,9 @@ class DocCog(commands.Cog):
description=markdown
)
# Show all symbols with the same name that were renamed in the footer.
- if renamed_symbols := self.renamed_symbols[symbol]:
- footer_text = f"Moved: {textwrap.shorten(', '.join(renamed_symbols), 100, placeholder=' ...')}"
+ if symbol in self.renamed_symbols:
+ renamed_symbols = ', '.join(self.renamed_symbols[symbol])
+ footer_text = f"Moved: {textwrap.shorten(renamed_symbols, 100, placeholder=' ...')}"
else:
footer_text = ""
embed.set_footer(text=footer_text)