handle image post
This commit is contained in:
parent
06b2171943
commit
83695acae7
1 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,15 @@ def on_receive_events(transaction):
|
||||||
else:
|
else:
|
||||||
token = app.config['MATRIX_PNUT_TOKEN']
|
token = app.config['MATRIX_PNUT_TOKEN']
|
||||||
text = "* " + get_displayname(event["user_id"]) + " " + event['content']['body']
|
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:
|
else:
|
||||||
text = None
|
text = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue