Rename MessageHandler to CommandHandler and put Error at top level

This commit is contained in:
2019-02-27 12:58:05 +01:00
parent 7d2ba56450
commit 23b27c37c3
2 changed files with 12 additions and 12 deletions

View File

@@ -279,7 +279,7 @@ class XMPPTelegram(ComponentXMPP):
if is_command:
command = msg["body"].split(" ")[0][1:]
handler = GateMessageHandler(msg)._handler
handler = GateCommandHandler(msg)._handler
try:
reply = str(handler(self))
except Exception as e:
@@ -290,7 +290,7 @@ class XMPPTelegram(ComponentXMPP):
else:
if isinstance(e, NotAuthorizedError):
reply = str(e)
elif isinstance(e, MessageHandler.WrongNumberOfArgsError):
elif isinstance(e, WrongNumberOfArgsError):
reply = str(e)
else:
logging.error("Exception in command from {}, command was '{}'".format(msg["from"],msg["body"]))
@@ -317,7 +317,7 @@ class XMPPTelegram(ComponentXMPP):
else:
if isinstance(e, NotAuthorizedError):
reply = str(e)
elif isinstance(e, MessageHandler.WrongNumberOfArgsError):
elif isinstance(e, WrongNumberOfArgsError):
reply = str(e)
else:
logging.error("Exception in command from {}, command was '{}'".format(msg["from"],msg["body"]))
@@ -344,7 +344,7 @@ class XMPPTelegram(ComponentXMPP):
else:
if isinstance(e, NotAuthorizedError):
reply = str(e)
elif isinstance(e, MessageHandler.WrongNumberOfArgsError):
elif isinstance(e, WrongNumberOfArgsError):
reply = str(e)
else:
logging.error("Exception in command from {}, command was '{}'".format(msg["from"],msg["body"]))