From d3c97eedfef3ce146e40ad5f194eb7f4e7064905 Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Mon, 6 Jan 2020 22:48:43 +0100 Subject: [PATCH] [Downloader] Fix `AttributeError` in `[p]findcog` for cogs that weren't installed through Downloader (#3278) * Update downloader.py * Create 3278.misc.rst --- changelog.d/downloader/3278.misc.rst | 1 + redbot/cogs/downloader/downloader.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/downloader/3278.misc.rst diff --git a/changelog.d/downloader/3278.misc.rst b/changelog.d/downloader/3278.misc.rst new file mode 100644 index 000000000..77ab3eedc --- /dev/null +++ b/changelog.d/downloader/3278.misc.rst @@ -0,0 +1 @@ +Fix `AttributeError` in ``[p]findcog`` for cogs that weren't installed through Downloader. diff --git a/redbot/cogs/downloader/downloader.py b/redbot/cogs/downloader/downloader.py index 25fd59947..d2f35e828 100644 --- a/redbot/cogs/downloader/downloader.py +++ b/redbot/cogs/downloader/downloader.py @@ -1281,6 +1281,7 @@ class Downloader(commands.Cog): """ if isinstance(cog_installable, Installable): + is_installable = True made_by = ", ".join(cog_installable.author) or _("Missing from info.json") repo_url = ( _("Missing from installed repos") @@ -1289,6 +1290,7 @@ class Downloader(commands.Cog): ) cog_name = cog_installable.name else: + is_installable = False made_by = "26 & co." repo_url = "https://github.com/Cog-Creators/Red-DiscordBot" cog_name = cog_installable.__class__.__name__ @@ -1296,7 +1298,7 @@ class Downloader(commands.Cog): msg = _( "Command: {command}\nCog name: {cog}\nMade by: {author}\nRepo: {repo_url}\n" ).format(command=command_name, author=made_by, repo_url=repo_url, cog=cog_name) - if cog_installable.repo is not None and cog_installable.repo.branch: + if is_installable and cog_installable.repo is not None and cog_installable.repo.branch: msg += _("Repo branch: {branch_name}\n").format( branch_name=cog_installable.repo.branch )