You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
node-red-contrib-matrix-cha.../examples/deactivate-user.json

116 lines
2.2 KiB

[
{
"id": "843c48978ab1b0a0",
"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": 590,
"y": 3260,
"wires": [
[
"b77d071077487ddc"
]
]
},
{
"id": "93ea76ce5e65a250",
"type": "matrix-receive",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"roomId": "",
"acceptText": true,
"acceptEmotes": false,
"acceptStickers": false,
"acceptReactions": false,
"acceptFiles": false,
"acceptImages": false,
"x": 420,
"y": 3260,
"wires": [
[
"843c48978ab1b0a0"
]
]
},
{
"id": "d6795b522954bccd",
"type": "comment",
"z": "f025a8b9fbd1b054",
"name": "Respond to \"deactivate_user <user_id>\" by deactivating the user on the server",
"info": "",
"x": 590,
"y": 3220,
"wires": []
},
{
"id": "b77d071077487ddc",
"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": 770,
"y": 3260,
"wires": [
[
"3c0e1e130e91206e"
]
]
},
{
"id": "3c0e1e130e91206e",
"type": "function",
"z": "f025a8b9fbd1b054",
"name": "",
"func": "let matches = msg.payload.match(/^deactivate_user ?(\\@.*)?/);\nmsg.userId = matches[1].trim() ? matches[1].trim() : null;\nif(!msg.userId) {\n return null;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 3320,
"wires": [
[
"1f4870b7171cc70f"
]
]
},
{
"id": "1f4870b7171cc70f",
"type": "matrix-synapse-deactivate-user",
"z": "f025a8b9fbd1b054",
"name": "",
"server": null,
"x": 610,
"y": 3320,
"wires": [
[],
[]
]
}
]