From 4203f87f3ded502ce610baff975ee4b57e45e9f7 Mon Sep 17 00:00:00 2001 From: Dusty Pianalto Date: Wed, 6 Nov 2019 22:35:09 -0900 Subject: [PATCH] Change bot commands to not process m.notice Change bot to send m.notice instead of m.text --- morpheus/core/client.py | 2 +- morpheus/exts/bot.py | 3 +++ morpheus/exts/command.py | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/morpheus/core/client.py b/morpheus/core/client.py index a8f70f0..2908afc 100644 --- a/morpheus/core/client.py +++ b/morpheus/core/client.py @@ -192,7 +192,7 @@ class Client: async def send_text(self, room: Room, body: str, formatted_body: str = None, format_type: str = None): content = { - 'msgtype': 'm.text', + 'msgtype': 'm.notice', 'body': body } if formatted_body and format_type: diff --git a/morpheus/exts/bot.py b/morpheus/exts/bot.py index 47a91eb..e4fa32e 100644 --- a/morpheus/exts/bot.py +++ b/morpheus/exts/bot.py @@ -68,6 +68,9 @@ class Bot(Client): return Context.get_context(event, prefix, called_with, body) async def process_command(self, event): + if not event.content.msgtype == 'm.text': + return + ctx = await self.get_context(event) if not ctx: return diff --git a/morpheus/exts/command.py b/morpheus/exts/command.py index 31e1d35..22ed980 100644 --- a/morpheus/exts/command.py +++ b/morpheus/exts/command.py @@ -78,7 +78,6 @@ class Command: args.extend(params.__dict__[key]) else: kwargs[key] = params.__dict__[key] - await self.function(ctx, *args, **kwargs) else: await self.function(ctx)