handle unknown command

This commit is contained in:
Frank Becker 2020-02-07 17:54:36 +01:00
parent 2f9d7a708e
commit 8ff616246c
1 changed files with 16 additions and 11 deletions

5
bot.py
View File

@ -123,6 +123,7 @@ class Bot:
moduleobject = self.modules.get(command)
if moduleobject is not None:
if moduleobject.enabled:
try:
await moduleobject.matrix_message(bot, room, event)
@ -134,6 +135,10 @@ class Bot:
await self.send_text(room,
f'Module {command} experienced difficulty: {sys.exc_info()[0]} - see log for details')
traceback.print_exc(file=sys.stderr)
else:
print(f"Unknown command: {command}")
await self.send_text(room, f"Sorry. I don't know what to do. Execute !help to get a list of available commands.")
async def invite_cb(self, room, event):
room: MatrixRoom