forwarder: ignore Matrix events older than 2 minutes

This commit is contained in:
Peter Cai 2021-01-17 10:36:27 +08:00
parent ae5350556a
commit 37d0091aa1
1 changed files with 5 additions and 0 deletions

View File

@ -125,6 +125,11 @@ module.exports = class Forwarder {
return; // Prevent loop
}
if (Date.now() - event.getTs() >= 2 * 60 * 1000) {
// Ignore events older than 2 minutes
return;
}
let content = event.getContent();
if (event.getType() == "m.room.message" && this.isMatrixCommand(content.body)) {