mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-04-20 04:53:06 -06:00
- #100 add documentation for new typing node and update README
- #100 fix typing event causing server error due to number being string - Mention using pantalaimon as an alternative for E2EE support in README
This commit is contained in:
parent
785e0cd7be
commit
d7c4bc26bb
@ -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
|
||||
|
@ -24,6 +24,7 @@ Build something cool with these nodes? Feel free to submit a pull request to sha
|
||||
- [Respond to "rooms <user_id>" with user's rooms (list server's rooms if <user_id> is left blank)](#respond-to-rooms-user_id-with-users-rooms-list-servers-rooms-if-user_id-is-left-blank)
|
||||
- [Respond to "whois <user_id>" 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
|
||||

|
||||
|
||||
|
||||
### 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).
|
||||
|
||||

|
||||
|
||||
|
||||
### Kick/Ban user from room
|
||||
|
||||
[View JSON](room-kick-ban.json)
|
||||
|
127
examples/send-typing-events.json
Normal file
127
examples/send-typing-events.json
Normal file
@ -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": []
|
||||
}
|
||||
]
|
BIN
examples/send-typing-events.png
Normal file
BIN
examples/send-typing-events.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -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 @@
|
||||
<label for="node-input-room"><i class="fa fa-clock-o"></i> Timeout Milliseconds</label>
|
||||
<input type="text" id="node-input-timeoutMs">
|
||||
</div>
|
||||
|
||||
<div class="form-row form-tips">
|
||||
Timeout MS is how many milliseconds the server should show the user typing for.
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="matrix-typing">
|
||||
|
@ -33,6 +33,7 @@ module.exports = function(RED) {
|
||||
node.on('input', async function(msg) {
|
||||
if (! node.server || ! node.server.matrixClient) {
|
||||
node.error("No matrix server selected", msg);
|
||||
node.send([null, msg]);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -54,6 +55,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
} else if(type === "bool") {
|
||||
value = (property === 'true');
|
||||
} else if(type === "num") {
|
||||
value = Number(property);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -68,7 +71,6 @@ module.exports = function(RED) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("sending typing",roomId, typing, timeoutMs);
|
||||
await node.server.matrixClient.sendTyping(roomId, typing, timeoutMs);
|
||||
node.send([msg, null]);
|
||||
} catch(e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user