node-red-contrib-matrix-cha.../examples/respond-users-list.json

103 lines
2.0 KiB
JSON
Raw Normal View History

2021-08-19 04:19:20 +08:00
[
{
"id": "a9b412957063b06c",
"type": "matrix-receive",
"z": "f025a8b9fbd1b054",
"name": "",
"roomId": "",
"ignoreText": false,
"ignoreReactions": false,
"ignoreFiles": false,
"ignoreImages": false,
"x": 460,
"y": 120,
"wires": [
[
"4aa45cd8653ba898"
]
]
},
{
"id": "4aa45cd8653ba898",
"type": "switch",
"z": "f025a8b9fbd1b054",
"name": "msg.payload == \"users\"",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "users",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 670,
"y": 120,
"wires": [
[
"b95a674179d93416"
]
]
},
{
"id": "b95a674179d93416",
"type": "matrix-synapse-users",
"z": "f025a8b9fbd1b054",
"name": "",
"x": 890,
"y": 120,
"wires": [
[
"19b654e5f28d93c4"
],
[]
]
},
{
"id": "8720c66e867f89f6",
"type": "matrix-send-message",
"z": "f025a8b9fbd1b054",
"name": "Send HTML Notice",
"roomId": "",
"messageType": "m.notice",
"messageFormat": "html",
"x": 1230,
"y": 120,
"wires": [
[],
[]
]
},
{
"id": "19b654e5f28d93c4",
"type": "function",
"z": "f025a8b9fbd1b054",
"name": "",
"func": "let new_payload = '<ul>';\nmsg.payload.users.forEach(function(user, index){\n new_payload += '<li>'+ JSON.stringify(user, null, 2).replace(/(?:\\r\\n|\\r|\\n)/g, \"\\n<br>\"); + '</li>'\n});\nmsg.payload = new_payload + '</ul>';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1060,
"y": 120,
"wires": [
[
"8720c66e867f89f6"
]
]
},
{
"id": "563da45ab1747c2b",
"type": "comment",
"z": "f025a8b9fbd1b054",
"name": "Response to \"users\" with full server user list",
"info": "",
"x": 550,
"y": 80,
"wires": []
}
]