Prevent sending messages that start with !

This commit is contained in:
Skylar Ittner 2022-12-29 22:07:19 -07:00
parent 794480cb7a
commit 37b10eaa7e

View File

@ -544,6 +544,11 @@ client.login("m.login.password", {"user": settings.matrixuser, "password": setti
return;
}
if (event.getContent().body.toLowerCase().replace(/\s/g, "").startsWith("!")) {
sendMatrixNotice(event.getRoomId(), "I'm sorry, but my programming forbids me from sending text messages that start with `!`.");
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)) {