diff options
| -rw-r--r-- | bot/exts/info/doc/_cog.py | 5 | ||||
| -rw-r--r-- | bot/exts/info/doc/_parsing.py | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py index 4e48e81e5..fa59bcc42 100644 --- a/bot/exts/info/doc/_cog.py +++ b/bot/exts/info/doc/_cog.py @@ -292,7 +292,10 @@ class DocCog(commands.Cog): if markdown is None: log.debug(f"Redis cache miss for symbol `{symbol}`.") markdown = await self.item_fetcher.get_markdown(self.bot.http_session, symbol_info) - await self.doc_cache.set(redis_key, markdown) + if markdown is not None: + await self.doc_cache.set(redis_key, markdown) + else: + markdown = "Unable to parse the requested symbol." embed = discord.Embed( title=discord.utils.escape_markdown(symbol), diff --git a/bot/exts/info/doc/_parsing.py b/bot/exts/info/doc/_parsing.py index 82b2ca808..72e81982a 100644 --- a/bot/exts/info/doc/_parsing.py +++ b/bot/exts/info/doc/_parsing.py @@ -287,7 +287,7 @@ def _class_filter_factory(class_names: Iterable[str]) -> Callable[[Tag], bool]: return match_tag -def get_symbol_markdown(soup: BeautifulSoup, symbol_data: DocItem) -> str: +def get_symbol_markdown(soup: BeautifulSoup, symbol_data: DocItem) -> Optional[str]: """ Return parsed markdown of the passed symbol using the passed in soup, truncated to 1000 characters. @@ -296,7 +296,7 @@ def get_symbol_markdown(soup: BeautifulSoup, symbol_data: DocItem) -> str: symbol_heading = soup.find(id=symbol_data.symbol_id) if symbol_heading is None: log.warning("Symbol present in loaded inventories not found on site, consider refreshing inventories.") - return "Unable to parse the requested symbol." + return None signature = None # Modules, doc pages and labels don't point to description list tags but to tags like divs, # no special parsing can be done so we only try to include what's under them. |