aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-12-11 23:46:24 +0100
committerGravatar Numerlor <[email protected]>2020-12-15 05:02:11 +0100
commit97d0625823171a873393c8baf14212104b1ee955 (patch)
tree6de3b113bd94f7dbfd7e0da8c10183561def893c
parentMove parse_queue cleanup into finally block (diff)
Provide feedback to user when no cache to clear was found
While technically correct, always sending success could be misleading in case of a typo on the package
-rw-r--r--bot/exts/info/doc/_cog.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bot/exts/info/doc/_cog.py b/bot/exts/info/doc/_cog.py
index 603d7df97..933f4500e 100644
--- a/bot/exts/info/doc/_cog.py
+++ b/bot/exts/info/doc/_cog.py
@@ -454,5 +454,7 @@ class DocCog(commands.Cog):
@commands.has_any_role(*MODERATION_ROLES)
async def clear_cache_command(self, ctx: commands.Context, package_name: PackageName) -> None:
"""Clear the persistent redis cache for `package`."""
- await doc_cache.delete(package_name)
- await ctx.send(f"Successfully cleared the cache for `{package_name}`.")
+ if await doc_cache.delete(package_name):
+ await ctx.send(f"Successfully cleared the cache for `{package_name}`.")
+ else:
+ await ctx.send("No keys matching the package found.")