From e06b2f4f8140ec240ea19139ebc91fcf00874bb4 Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Thu, 24 Sep 2020 14:03:07 +0000 Subject: [PATCH] Fixed indexing error when certain message causes 0 length array. --- command.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/command.py b/command.py index c7135d3..1155a5d 100644 --- a/command.py +++ b/command.py @@ -21,7 +21,8 @@ class Command: @staticmethod def getCommand(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 "" @@ -40,7 +41,8 @@ class Command: if func is not None: try: await func(channel, *tuple(Command.getArgs(command))) - except TypeError: + except TypeError as e: + print(e) await channel.send("Incorrect usage.")