From 37b10eaa7e674b16f45fd81bb0bdacc2a2040480 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 29 Dec 2022 22:07:19 -0700 Subject: [PATCH] Prevent sending messages that start with ! --- main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.js b/main.js index 90e2059..00cb489 100644 --- a/main.js +++ b/main.js @@ -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)) {