Closed ghost closed 8 years ago
Ok, i've managed to do this, it's pretty simple
In router.py:
def route(self, message):
"Get the text from message and tests on every route for a match"
text = message.getBody()
for route, callback in self.views:
match = route.match(text)
if match:
threading.Thread(target=self.handle_callback, args=(callback, message, match)).start()
return
if text.startswith("/"):
threading.Thread(target=self.notfound, args=(text, message)).start()
def notfound(self, command, message):
self.toLower(TextMessageProtocolEntity("Command \"" + command + "\" not found or invalid syntax\nType /help for the command list", to=message.getFrom()))
Take a look to my pull request
How can i send a message if the command doesn't exist or have an invalid syntax?