Rename MessageHandler to CommandHandler and put Error at top level
This commit is contained in:
@@ -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"]))
|
||||
|
||||
Reference in New Issue
Block a user