Ignore old message events to prevent sending duplicate texts

master
Skylar Ittner 8 months ago
parent dce017b9e9
commit 29d196e3c1

@ -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…
Cancel
Save