diff options
author | 2021-02-02 21:53:44 +0100 | |
---|---|---|
committer | 2021-02-02 21:53:44 +0100 | |
commit | aace6002d8587b5a79c1ba456ac045a7351152dd (patch) | |
tree | 1f6380452368fafe18e8c494d8eff0df2e672072 | |
parent | Require a set of names to ignore instead of a blanket ignoring (diff) |
Attempt to resolve first part of the argument in case of a failed lookup
-rw-r--r-- | bot/exts/info/doc/_cog.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py index df076f162..16baa6320 100644 --- a/bot/exts/info/doc/_cog.py +++ b/bot/exts/info/doc/_cog.py @@ -244,8 +244,18 @@ class DocCog(commands.Cog): symbol_info = self.doc_symbols.get(symbol) if symbol_info is None: - log.debug("Symbol does not exist.") - return None + if symbol.count(" "): + # If an invalid symbol contains a space, check if the command was invoked + # in the format !d <symbol> <message> + symbol = symbol.split(" ", maxsplit=1)[0] + symbol_info = self.doc_symbols.get(symbol) + if symbol_info is None: + log.debug("Symbol does not exist.") + return None + else: + log.debug("Symbol does not exist.") + return None + self.bot.stats.incr(f"doc_fetches.{symbol_info.package}") with self.symbol_get_event: |