Fixed indexing error when certain message causes 0 length array.
This commit is contained in:
parent
05d1a813df
commit
e06b2f4f81
@ -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.")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user