handle image post

This commit is contained in:
Morgan McMillian 2017-05-02 22:43:23 -07:00
parent 06b2171943
commit 83695acae7

View file

@ -40,6 +40,15 @@ def on_receive_events(transaction):
else:
token = app.config['MATRIX_PNUT_TOKEN']
text = "* " + get_displayname(event["user_id"]) + " " + event['content']['body']
elif event['content']['msgtype'] == 'm.image':
imgurl = app.config['MATRIXBOT_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
if user:
token = user.pnut_token
text = ""
else:
token = app.config['MATRIX_PNUT_TOKEN']
text = "[" + get_displayname(event["user_id"]) + "] "
text += event['content']['body'] + " : " + imgurl
else:
text = None