Cog-Creators / Red-DiscordBot

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

Alias does not handle space-only alias gracefully #4069

Closed NeuroAssassin closed 4 years ago

NeuroAssassin commented 4 years ago

Command bugs

Command name

[p]alias add and [p]alias global add

What cog is this command from?

Alias

What were you expecting to happen?

My bot to say You attempted to create a new alias with a space but that name is an invalid alias name. Alias names may not contain spaces., or something close to that, handling it gracefully.

What actually happened?

Raised an error

Exception in command 'alias add' Traceback (most recent call last): File "/home/neuroassassin/Desktop/Red/modok/lib/python3.8/site-packages/discord/ext/commands/core.py", line 83, in wrapped ret = await coro(*args, **kwargs) File "/home/neuroassassin/Desktop/Red/modok/lib/python3.8/site-packages/redbot/cogs/alias/alias.py", line 142, in _add_alias is_command = self.is_command(alias_name) File "/home/neuroassassin/Desktop/Red/modok/lib/python3.8/site-packages/redbot/cogs/alias/alias.py", line 64, in is_command command = self.bot.get_command(alias_name) File "/home/neuroassassin/Desktop/Red/modok/lib/python3.8/site-packages/redbot/core/bot.py", line 196, in get_command com = super().get_command(name) File "/home/neuroassassin/Desktop/Red/modok/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1144, in get_command obj = self.all_commands.get(names[0]) IndexError: list index out of range

How can we reproduce this issue?

[p]alias add " " ping or [p]alias global add " " ping. Must be only the space.

Jackenmen commented 4 years ago

This will be fixed by d.py 1.4