Files
rmmanager/plugins/rmass/actions/synapsegetattachment.py
T

70 lines
1.4 KiB
Python

name = "Get Synapse Attachment"
kind = "action"
showstatus = True
alias = "synapsegetattachment"
depends = [
"synapsegetroomalias",
]
## PRE-RUNTIME ACTIONS
resolve = {
"get": {
"room_id": ["outmessageitem", "room_id"],
# "matrix_sender": ["outmessageitem", "sender"],
"msgtype": ["outmessageitem", "content", "msgtype"],
"synapse_image": ["outmessageitem", "content", "url"],
},
"deconstruct": {
"synapse_image" : [
#"#rmass_dm_",
"mxc://loxthelion.com/",
],
},
}
## RUNTIME ACTIONS
isrequest = True
method = "GET"
path = [
#"https://loxthelion.com/_matrix/client/v3/rooms/",
"https://loxthelion.com/_matrix/client/v1/media/download/loxthelion.com/",
{"resolved": "synapse_image"},
#"/state/m.room.canonical_alias",
#"?user_id=%40rmass_bridge%3Aloxthelion.com"
]
headers = {
"Authorization": {
"os": "AS_TOKEN",
"prefix": "Bearer ",
},
"Content-Type": "application/json",
}
## POST-RUNTIME ACTIONS
image = "synapse_attachment"
filters = [
{
"filterkey": "msgtype",
"operator": "==",
"filtervalue": "m.text",
"print": f"No image detected. Bypassing attachment push",
},
{
"filterkey": "event_id",
"operator": "==",
"filtervalue": {"outputs": "db_event_id"},
"print": f"Message already delivered. Bypassing {name}",
},
]