Fixed indexing error when certain message causes 0 length array.

This commit is contained in:
Sheldon Lee 2020-09-24 14:03:07 +00:00
parent 05d1a813df
commit e06b2f4f81

View File

@ -21,7 +21,8 @@ class Command:
@staticmethod @staticmethod
def getCommand(string): def getCommand(string):
words = Command.__getWords(string); words = Command.__getWords(string);
if words[0].startswith(Command.command_prefix) and len(words) >= 0: if len(words) == 0: return
if words[0].startswith(Command.command_prefix):
return words[0][1:] return words[0][1:]
return "" return ""
@ -40,7 +41,8 @@ class Command:
if func is not None: if func is not None:
try: try:
await func(channel, *tuple(Command.getArgs(command))) await func(channel, *tuple(Command.getArgs(command)))
except TypeError: except TypeError as e:
print(e)
await channel.send("Incorrect usage.") await channel.send("Incorrect usage.")