Skip to content

Commit 8d685c2

Browse files
committed
fix: allow up to 10 links only
1 parent a37be2a commit 8d685c2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

bot/exts/info/doc/_cog.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,21 @@ async def create_symbol_embed(self, symbol_name: str) -> discord.Embed | None:
324324
return embed
325325

326326
async def create_compact_doc_message(self, symbols: list[str]) -> str:
327-
"""Create a markdown bullet list of links to docs for the given list of symbols."""
327+
"""
328+
Create a markdown bullet list of links to docs for the given list of symbols.
329+
330+
Link to at most 10 items, ignoring the rest.
331+
"""
328332
items = await self._get_symbols_items(symbols)
329333
content = ""
334+
link_count = 0
330335
for symbol_name, doc_item in items:
336+
if link_count >= 10:
337+
break
331338
if doc_item is None:
332339
log.debug(f"{symbol_name=} does not exist.")
333340
else:
341+
link_count += 1
334342
content += f"- [{discord.utils.escape_markdown(symbol_name)}](<{doc_item.url}#{doc_item.symbol_id}>)\n"
335343

336344
return content

0 commit comments

Comments
 (0)