aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2019-10-20 18:39:08 +0200
committerGravatar Numerlor <[email protected]>2019-10-20 18:39:08 +0200
commitf1dbb63e6c4a7ed38f8bed994c109e638498d546 (patch)
tree18baf7905918935fa08a1ada0efce46c56645aca
parentadd handling for duplicate symbols in docs inventories (diff)
show renamed duplicates in embed footer
-rw-r--r--bot/cogs/doc.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py
index 43315f477..ecff43864 100644
--- a/bot/cogs/doc.py
+++ b/bot/cogs/doc.py
@@ -281,18 +281,23 @@ class Doc(commands.Cog):
if not signature:
# It's some "meta-page", for example:
# https://docs.djangoproject.com/en/dev/ref/views/#module-django.views
- return discord.Embed(
+ embed = discord.Embed(
title=f'`{symbol}`',
url=permalink,
description="This appears to be a generic page not tied to a specific symbol."
)
-
- signature = textwrap.shorten(signature, 500)
- return discord.Embed(
- title=f'`{symbol}`',
- url=permalink,
- description=f"```py\n{signature}```{description}"
- )
+ else:
+ signature = textwrap.shorten(signature, 500)
+ embed = discord.Embed(
+ title=f'`{symbol}`',
+ url=permalink,
+ description=f"```py\n{signature}```{description}"
+ )
+ # show all symbols with the same name that were renamed in the footer
+ embed.set_footer(text=", ".join(renamed for renamed in self.renamed_symbols - {symbol}
+ if renamed.endswith(f".{symbol}"))
+ )
+ return embed
@commands.group(name='docs', aliases=('doc', 'd'), invoke_without_command=True)
async def docs_group(self, ctx: commands.Context, symbol: commands.clean_content = None) -> None: