node-red-contrib-matrix-cha.../examples/force-join-room.json

117 lines
2.3 KiB
JSON
Raw Normal View History

[
{
"id": "897b8de477d7d0df",
"type": "switch",
"z": "f025a8b9fbd1b054",
"name": "is from me",
"property": "userId",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "@skylord123:skylar.tech",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 470,
"y": 3460,
"wires": [
[
"1f73f36092a9536b"
]
]
},
{
"id": "973b2caeb68f3a60",
"type": "matrix-receive",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"roomId": "",
"acceptText": true,
"acceptEmotes": false,
"acceptStickers": false,
"acceptReactions": false,
"acceptFiles": false,
"acceptImages": false,
"x": 300,
"y": 3460,
"wires": [
[
"897b8de477d7d0df"
]
]
},
{
"id": "be5c7290e6223b7b",
"type": "comment",
"z": "f025a8b9fbd1b054",
"name": "Say \"force_join <user_id> <room_id_or_alias>\" to force a user into a room",
"info": "",
"x": 460,
"y": 3420,
"wires": []
},
{
"id": "1f73f36092a9536b",
"type": "switch",
"z": "f025a8b9fbd1b054",
"name": "msg.payload filter",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "regex",
"v": "^deactivate_user",
"vt": "str",
"case": false
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 650,
"y": 3460,
"wires": [
[
"6a2a73bc9dfdaece"
]
]
},
{
"id": "6a2a73bc9dfdaece",
"type": "function",
"z": "f025a8b9fbd1b054",
"name": "",
"func": "let matches = msg.payload.match(/^force_join (\\@.*) (.*)/);\nmsg.userId = matches[1].trim() ? matches[1].trim() : null;\nif(!msg.userId) {\n return null;\n}\nmsg.topic = matches[2].trim() ? matches[2].trim() : null;\nif(!msg.topic) {\n return null;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 300,
"y": 3520,
"wires": [
[
"212e060e320918d3"
]
]
},
{
"id": "212e060e320918d3",
"type": "matrix-synapse-join-room",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"roomId": "",
"x": 490,
"y": 3520,
"wires": [
[],
[]
]
}
]