Repository: Cog-Creators/Red-DiscordBot

Issue:
[Core] findcog
# Command bugs

<!-- 
Did you find a bug with a command? Fill out the following:
-->

#### Command name

findcog

#### What cog is this command from?

Downloader

#### What were you expecting to happen?

<!-- Replace this line with a description of what you were expecting to happen -->

The command to show

<!-- Replace this line with a description of what actually happened. Include any error messages -->

Use findcog on a custom added cog that has no info.json.

```py
Exception in command 'findcog'
Traceback (most recent call last):
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\discord\ext\commands\core.py", line 83, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\redbot\cogs\downloader\downloader.py", line 1392, in findcog
    made_by = humanize_list(cog_installable.author) or _("Missing from info.json")
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\redbot\core\utils\chat_formatting.py", line 390, in humanize_list
    raise IndexError("Cannot humanize empty sequence") from None
IndexError: Cannot humanize empty sequence

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\discord\ext\commands\bot.py", line 892, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\discord\ext\commands\core.py", line 797, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Data\Red\CanaryVenv-3.8.2\lib\site-packages\discord\ext\commands\core.py", line 92, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: Cannot humanize empty sequence
```

<!-- Replace with numbered steps to reproduce the issue -->
Add a custom cog
use findcog on it.

Haven't tried non-embeds.


Discussion:
Oh no this must be because of my changes to findcog...
If nobody fixes this until 3.4 release, this is gonna get auto-fixed by the changes to `humanize_list()`
This is gonna be a regression in 3.3.10 so anyone can feel free to make a fix for it, but I'm leaving this be.

Resolving patch:
diff --git a/redbot/cogs/downloader/downloader.py b/redbot/cogs/downloader/downloader.py
--- a/redbot/cogs/downloader/downloader.py
+++ b/redbot/cogs/downloader/downloader.py
@@ -1387,7 +1387,11 @@ async def findcog(self, ctx: commands.Context, command_name: str) -> None:
             cog_name = self.cog_name_from_instance(cog)
             installed, cog_installable = await self.is_installed(cog_name)
             if installed:
-                made_by = humanize_list(cog_installable.author) or _("Missing from info.json")
+                made_by = (
+                    humanize_list(cog_installable.author)
+                    if cog_installable.author
+                    else _("Missing from info.json")
+                )
                 repo_url = (
                     _("Missing from installed repos")
                     if cog_installable.repo is None


Test patch: