Ignore old message events to prevent sending duplicate texts
This commit is contained in:
parent
dce017b9e9
commit
29d196e3c1
5
main.js
5
main.js
@ -502,6 +502,11 @@ client.on("Room.timeline", function (event, room) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getTs() < (Date.now() - 1000 * 60 * 60 * 8)) {
|
||||
// Ignore old events (8 hrs), they're probably duplicates or something.
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getContent().body.toLowerCase().startsWith("!sms")) {
|
||||
// capture command to start room for new number
|
||||
const matches = event.getContent().body.match(/([1-9]?[0-9]{10})/g);
|
||||
|
Loading…
x
Reference in New Issue
Block a user