|
|
|
@ -511,28 +511,12 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event.getContent().body.toLowerCase().startsWith("!fixnumbers")) {
|
|
|
|
|
// capture command to start room for new number
|
|
|
|
|
const matches = event.getContent().body.match(/([1-9]?[0-9]{10})/g);
|
|
|
|
|
if (matches.length == 2) {
|
|
|
|
|
var tel = matches[0];
|
|
|
|
|
if (tel.length == 10) {
|
|
|
|
|
// make it the full number
|
|
|
|
|
tel = "1" + tel;
|
|
|
|
|
}
|
|
|
|
|
var ournumber = matches[1];
|
|
|
|
|
if (ournumber.length == 10) {
|
|
|
|
|
// make it the full number
|
|
|
|
|
ournumber = "1" + ournumber;
|
|
|
|
|
}
|
|
|
|
|
logger.info("Got request from " + event.getSender() + " to set SMS from number to " + ournumber + " for SMS conversation with " + tel + ".");
|
|
|
|
|
client.setRoomTag(event.getRoomId(), "u.matrix-bridge-voxtelesys-sms", {tel: tel, ournumber: ournumber, order: 0.5}).then(function () {
|
|
|
|
|
sendMatrixNotice(event.getRoomId(), "Now sending SMS from " + ournumber + " to " + tel + ".");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if (event.getContent().body.toLowerCase().replace(/\s/g, "").startsWith("!sms")) {
|
|
|
|
|
sendMatrixNotice(event.getRoomId(), "Malformed command detected, ignoring.");
|
|
|
|
|
sendMatrixNotice(event.getRoomId(), "Hint: there aren't supposed to be any spaces before or in the \"!sms\" part.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.getContent().body.toLowerCase().startsWith("!fixusers")) {
|
|
|
|
|
sendMatrixNotice(event.getRoomId(), "Inviting missing users across all SMS chats.");
|
|
|
|
|
|
|
|
|
@ -554,8 +538,12 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
} else if (event.getContent().body.toLowerCase().replace(/\s/g, "").startsWith("!fixusers")) {
|
|
|
|
|
sendMatrixNotice(event.getRoomId(), "Malformed command detected, ignoring.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var matches = room.name.match(/SMS_([1-9][0-9]+)(?:_([1-9][0-9]+))?/g);
|
|
|
|
|
console.log(event.getRoomId());
|
|
|
|
|
if (matches == null || (matches.length != 1 && matches.length != 2)) {
|
|
|
|
|