From c1bcca44328e995e6e9fb3bb28b6f10517c2a35d Mon Sep 17 00:00:00 2001 From: El Laggron Date: Mon, 25 Jun 2018 04:42:47 +0200 Subject: [PATCH] [V3 Downloader] Allow use of prefix in install message (#1869) * [V3 Downloader] Allow to use the prefix in install msg * Update docs * Let's do the same for repo addition * Fix indent * Use replace instead of format * Update docs --- docs/framework_downloader.rst | 3 +++ redbot/cogs/downloader/downloader.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/framework_downloader.rst b/docs/framework_downloader.rst index fcca8619f..45d75e459 100644 --- a/docs/framework_downloader.rst +++ b/docs/framework_downloader.rst @@ -20,6 +20,9 @@ Keys common to both repo and cog info.json (case sensitive) - ``install_msg`` (string) - The message that gets displayed when a cog is installed or a repo is added + + .. tip:: You can use the ``[p]`` key in your string to use the prefix + used for installing. - ``short`` (string) - A short description of the cog or repo. For cogs, this info is displayed when a user executes ``!cog list`` diff --git a/redbot/cogs/downloader/downloader.py b/redbot/cogs/downloader/downloader.py index 87b69be4c..f9d3090a6 100644 --- a/redbot/cogs/downloader/downloader.py +++ b/redbot/cogs/downloader/downloader.py @@ -234,7 +234,7 @@ class Downloader: else: await ctx.send(_("Repo `{}` successfully added.").format(name)) if repo.install_msg is not None: - await ctx.send(repo.install_msg) + await ctx.send(repo.install_msg.replace("[p]", ctx.prefix)) @repo.command(name="delete") async def _repo_del(self, ctx, repo_name: Repo): @@ -319,7 +319,7 @@ class Downloader: await ctx.send(_("`{}` cog successfully installed.").format(cog_name)) if cog.install_msg is not None: - await ctx.send(cog.install_msg) + await ctx.send(cog.install_msg.replace("[p]", ctx.prefix)) @cog.command(name="uninstall") async def _cog_uninstall(self, ctx, cog_name: InstalledCog):