diff --git a/README.md b/README.md index 32d723b..2bddaa6 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,11 @@ The following is supported from this package: - End-to-end encryption - [Currently a WIP](#end-to-end-encryption-notes) + - Can also use [pantalaimon](https://github.com/matrix-org/pantalaimon) as an alternative solution to E2EE (if you need multiple sessions synced up with keys) - Receive events from a room (messages, reactions, images, audio, locations, and files) whether encrypted or not - Send Images/Files (sending files to e2ee room doesn't currently encrypt them yet) - Edit messages +- Send typing events (Bot is typing ...) - Delete events (messages, reactions, etc) - Decrypt files in e2ee rooms - Send HTML/Plain Text Message/Notice diff --git a/examples/README.md b/examples/README.md index 5eaf8cf..9385a2e 100644 --- a/examples/README.md +++ b/examples/README.md @@ -24,6 +24,7 @@ Build something cool with these nodes? Feel free to submit a pull request to sha - [Respond to "rooms " with user's rooms (list server's rooms if is left blank)](#respond-to-rooms-user_id-with-users-rooms-list-servers-rooms-if-user_id-is-left-blank) - [Respond to "whois " with information about the user's session](#respond-to-whois-user_id-with-information-about-the-users-session) - [Respond to "room_users" with current room's users](#respond-to-room_users-with-current-rooms-users) +- [Sending typing events to a room](#sending-typing-events-to-a-room) - [Download & store all received files/images](#download--store-all-received-filesimages) - [Kick/Ban user from room](#kickban-user-from-room) - [Deactivate user](#deactivate-user) @@ -221,6 +222,15 @@ Note: You may need to edit the storage directory for this to work. Default actio ![store-received-files.png](store-received-files.png) +### Sending typing events to a room + +[View JSON](send-typing-events.json) + +You can tell a room that Node-RED is writing a message and also cancel the writing event. This can be useful for making bots feel more interactive (show typing while requesting API endpoint for example). + +![store-received-files.png](send-typing-events.png) + + ### Kick/Ban user from room [View JSON](room-kick-ban.json) diff --git a/examples/send-typing-events.json b/examples/send-typing-events.json new file mode 100644 index 0000000..e73f7b7 --- /dev/null +++ b/examples/send-typing-events.json @@ -0,0 +1,127 @@ +[ + { + "id": "541dbfc3f04220cf", + "type": "matrix-typing", + "z": "f025a8b9fbd1b054", + "name": "", + "server": null, + "roomType": "msg", + "roomValue": "topic", + "typingType": "msg", + "typingValue": "typing", + "timeoutMsType": "num", + "timeoutMsValue": "20000", + "x": 1090, + "y": 220, + "wires": [ + [ + "febf8236f3683963" + ], + [ + "9db9819ebb6343c8" + ] + ] + }, + { + "id": "d7c3714c657bfe4f", + "type": "inject", + "z": "f025a8b9fbd1b054", + "name": "Start Typing", + "props": [ + { + "p": "topic", + "vt": "str" + }, + { + "p": "typing", + "v": "true", + "vt": "bool" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "!mohVKgDFYUubJQHcuX:skylar.tech", + "x": 910, + "y": 200, + "wires": [ + [ + "541dbfc3f04220cf" + ] + ] + }, + { + "id": "783121ff1a6bd833", + "type": "inject", + "z": "f025a8b9fbd1b054", + "name": "Stop Typing", + "props": [ + { + "p": "topic", + "vt": "str" + }, + { + "p": "typing", + "v": "false", + "vt": "bool" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "!mohVKgDFYUubJQHcuX:skylar.tech", + "x": 910, + "y": 240, + "wires": [ + [ + "541dbfc3f04220cf" + ] + ] + }, + { + "id": "9db9819ebb6343c8", + "type": "debug", + "z": "f025a8b9fbd1b054", + "name": "Failure msg", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 1270, + "y": 240, + "wires": [] + }, + { + "id": "febf8236f3683963", + "type": "debug", + "z": "f025a8b9fbd1b054", + "name": "Success msg", + "active": true, + "tosidebar": true, + "console": false, + "tostatus": false, + "complete": "true", + "targetType": "full", + "statusVal": "", + "statusType": "auto", + "x": 1270, + "y": 200, + "wires": [] + }, + { + "id": "01e8c4c6303af390", + "type": "comment", + "z": "f025a8b9fbd1b054", + "name": "Send typing events to a room", + "info": "", + "x": 940, + "y": 160, + "wires": [] + } +] \ No newline at end of file diff --git a/examples/send-typing-events.png b/examples/send-typing-events.png new file mode 100644 index 0000000..703bc2d Binary files /dev/null and b/examples/send-typing-events.png differ diff --git a/src/matrix-typing.html b/src/matrix-typing.html index 0be8db8..b426357 100644 --- a/src/matrix-typing.html +++ b/src/matrix-typing.html @@ -12,7 +12,7 @@ roomType: { value: "msg" }, roomValue: { value: "topic" }, typingType: { value: "bool" }, - typingValue: { value: true }, + typingValue: { value: "true" }, timeoutMsType: { value: "num" }, timeoutMsValue: { value: 20000 }, }, @@ -74,6 +74,10 @@ + +
+ Timeout MS is how many milliseconds the server should show the user typing for. +