From c90b6f6cce5e0c9f6c34e663c5d4e6a83fc1c394 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Fri, 20 Apr 2018 12:34:56 -0700 Subject: [PATCH] Ignore non-message event for now and disable the broken bot code #31 --- appservice.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/appservice.py b/appservice.py index 562bd9f..fb6f035 100644 --- a/appservice.py +++ b/appservice.py @@ -41,6 +41,9 @@ def on_receive_events(transaction): cmdbot.on_message(event) return jsonify({}) + if 'msgtype' not in event['content']: + return jsonify({}) + if (event['content']['msgtype'] == 'm.text' or event['content']['msgtype'] == 'm.notice'): if user: @@ -163,10 +166,10 @@ def on_receive_events(transaction): if event['content']['membership'] == 'invite' and 'is_direct' in event['content'] and event['content']['is_direct'] == True: logging.info('>> GOT PRIVATE INVITE') - cmdbot.on_invite(event) - addadminrm = MatrixAdminRooms(matrix_id=event['sender'], room_id=event['room_id']) - db.session.add(addadminrm) - db.session.commit() + # cmdbot.on_invite(event) + # addadminrm = MatrixAdminRooms(matrix_id=event['sender'], room_id=event['room_id']) + # db.session.add(addadminrm) + # db.session.commit() elif event['content']['membership'] == 'invite': logging.info('>> GOT ROOM INVITE')