bot - better handling of autocompletion on mobile devices

This commit is contained in:
Stefan Müller 2016-01-06 13:39:34 +01:00
parent 2d9ac3037e
commit 36eda158f2

4
bot.py
View file

@ -42,7 +42,7 @@ class Bot():
} }
def parse(self, message): def parse(self, message):
args = message.split(" ") args = message.strip().split(" ")
cmd = args.pop(0) cmd = args.pop(0)
if cmd[0] == '\\': if cmd[0] == '\\':
@ -56,7 +56,7 @@ class Bot():
self.send("a valid command starts with a backslash") self.send("a valid command starts with a backslash")
def call(self, cmd, args = []): def call(self, cmd, args = []):
func = self.commands[cmd] func = self.commands[cmd.lower()]
spec = inspect.getargspec(func) spec = inspect.getargspec(func)
maxs = len(spec.args) - 1 maxs = len(spec.args) - 1
reqs = maxs - len(spec.defaults or []) reqs = maxs - len(spec.defaults or [])