Ignore old message events to prevent sending duplicate texts
This commit is contained in:
parent
29d196e3c1
commit
5303dd24cd
10
main.js
10
main.js
@ -497,13 +497,13 @@ client.on("Room.timeline", function (event, room) {
|
||||
if (client.getUserId() == event.getSender()) {
|
||||
return; // skip own messages to prevent loop
|
||||
}
|
||||
if (event.getContent() == null || typeof event.getContent().body == "undefined" || event.getContent().body == null) {
|
||||
// Apparently this can happen?
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getTs() < (Date.now() - 1000 * 60 * 60 * 8)) {
|
||||
// Ignore old events (8 hrs), they're probably duplicates or something.
|
||||
logger.info("Ignoring stale Matrix room event");
|
||||
return;
|
||||
}
|
||||
if (event.getContent() == null || typeof event.getContent().body == "undefined" || event.getContent().body == null) {
|
||||
// Apparently this can happen?
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
"express": "^4.17.2",
|
||||
"file-type": "^16.5.0",
|
||||
"log4js": "^6.3.0",
|
||||
"matrix-js-sdk": "^17.2.0",
|
||||
"matrix-js-sdk": "^19.7.0",
|
||||
"request": "^2.88.2"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user