- Bump version to 0.4.6

- Added example for force joining a room
- Deactivate a user example was missing json file contents
51-device_id-fix
Skylar Sadlier 3 years ago
parent 6dd2ec75f0
commit 282c8ffc80

@ -210,3 +210,13 @@ Note: This requires the bot to be a server admin.
WARNING: Accounts that are deleted cannot be restored. If you want to temp-disable edit the user instead.
![room-kick-ban.png](deactivate-user.png)
### Force user to join room
[View JSON](deactivate-user.json)
If you say "force_join @test:example.com !320j90mf0394f:example.com" the bot will force the user `@test:example.com` into room `!320j90mf0394f:example.com`
Note: This requires the bot to be a server admin. This also only works for rooms on the same server.
![room-kick-ban.png](deactivate-user.png)

@ -0,0 +1,116 @@
[
{
"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": [
[],
[]
]
}
]

@ -0,0 +1,117 @@
[
{
"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": [
[],
[]
]
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-matrix-chat",
"version": "0.4.5",
"version": "0.4.6",
"description": "Matrix chat server client for Node-RED",
"dependencies": {
"fs-extra": "^10.0.0",

Loading…
Cancel
Save