parent
b4923409be
commit
91ede1edc7
1 changed files with 4 additions and 13 deletions
|
@ -149,19 +149,10 @@ def on_receive_events(transaction):
|
||||||
if event['content']['membership'] == 'invite' and 'is_direct' in event['content'] and event['content']['is_direct'] == True:
|
if event['content']['membership'] == 'invite' and 'is_direct' in event['content'] and event['content']['is_direct'] == True:
|
||||||
|
|
||||||
logging.info('>> GOT PRIVATE INVITE')
|
logging.info('>> GOT PRIVATE INVITE')
|
||||||
txId += 1
|
cmdbot.on_invite(event)
|
||||||
url = app.config['MATRIX_HOST']
|
addadminrm = MatrixAdminRooms(matrix_id=event['sender'], room_id=event['room_id'])
|
||||||
url += '/_matrix/client/r0/join/' + event['room_id']
|
db.session.add(addadminrm)
|
||||||
url += "?access_token=" + app.config['MATRIX_AS_TOKEN']
|
db.session.commit()
|
||||||
r = requests.post(url, headers={"Content-Type": "application/json"},
|
|
||||||
data=json.dumps({}))
|
|
||||||
if r.status_code == 200:
|
|
||||||
addadminrm = MatrixAdminRooms(matrix_id=event['sender'], room_id=event['room_id'])
|
|
||||||
db.session.add(addadminrm)
|
|
||||||
db.session.commit()
|
|
||||||
else:
|
|
||||||
print(r.status_code)
|
|
||||||
print(r.text)
|
|
||||||
|
|
||||||
elif event['content']['membership'] == 'invite':
|
elif event['content']['membership'] == 'invite':
|
||||||
logging.info('>> GOT ROOM INVITE')
|
logging.info('>> GOT ROOM INVITE')
|
||||||
|
|
Loading…
Reference in a new issue