From f5235b16343816b02ceef56d1e753cb0167c6b03 Mon Sep 17 00:00:00 2001 From: Numerlor <25886452+Numerlor@users.noreply.github.com> Date: Mon, 11 Jan 2021 02:42:19 +0100 Subject: 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 --- bot/exts/info/doc/_cog.py | 5 +++-- 1 file 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) -- cgit v1.2.3