Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.78k stars 2.3k forks source link

Custom Command create random error #3416

Closed Brandjuh closed 4 years ago

Brandjuh commented 4 years ago

Command bugs

Command name

customcom create random

What cog is this command from?

Core

What were you expecting to happen?

I tried to create custom command with a random output, without filling in data I wanted to exit() the command maker.

What actually happened?

image

How can we reproduce this issue?

Add a custom command with random output, instead of adding data just exit() it.

Exception in command 'customcom create random'
Traceback (most recent call last):
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "/root/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 231, in cc_create_random
    await self.commandobj.create(ctx=ctx, command=command, response=responses)
  File "/root/.local/lib/python3.8/site-packages/redbot/cogs/customcom/customcom.py", line 109, in create
    ctx.cog.prepare_args(response if isinstance(response, str) else response[0])
IndexError: list index out of range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 863, in invoke
    await ctx.command.invoke(ctx)
  File "/root/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 631, in invoke
    await super().invoke(ctx)
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1158, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/root/.local/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 631, in invoke
    await super().invoke(ctx)
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1158, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 728, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/root/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 88, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range
Jackenmen commented 4 years ago

I saw this issue before and I'm a little surprised that it wasn't reported on our issue tracker yet, so thanks for the report 😄