diff --git a/main.py b/main.py index f8aa107..76af82b 100644 --- a/main.py +++ b/main.py @@ -39,7 +39,7 @@ rooms = client.get_rooms() def room_callback(event): room = rooms[event[u'room_id']] reload() - if u'user_id' in event and event[u'type'] == "m.room.message": + if event[u'type'] == "m.room.message": print room.name, "<"+event[u'user_id']+">", event[u'content'][u'body'] if event[u'user_id'] == config["me"]["user"]: return @@ -60,6 +60,13 @@ def room_callback(event): m = args['re'].search(body) if m: room.send_text(func(m)) + elif u'invite_room_state' in event: + for user in config["masters"]: + if event[u'user_id'] == user: + client.join_room(event[u'room_id']) + print user, "asked me to join", event[u'room_id'] + #else: + # print dump(event) for room in rooms: rooms[room].add_listener(room_callback)