diff --git a/package.json b/package.json index 9d8af7e..86417c5 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "license": "ISC", "dependencies": { "dotenv": "^16.3.1", - "firebase": "^9.23.0", + "firebase": "^11.1.0", "qrcode-terminal": "^0.12.0", - "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#webpack-exodus" + "whatsapp-web.js": "^1.26.0" }, "devDependencies": { "@types/qrcode-terminal": "^0.12.0", diff --git a/src/constants/yeshiva-years.ts b/src/constants/yeshiva-years.ts index 122d604..b4b8521 100644 --- a/src/constants/yeshiva-years.ts +++ b/src/constants/yeshiva-years.ts @@ -14,5 +14,10 @@ export const ALL_YESHIVA_YEARS: string[] = [ "יג", "יד", "טו", + "טז", + "יז", + "יח", + "יט", + "כ", "ללא שנה", ]; diff --git a/src/firebase/shabbas-manage.ts b/src/firebase/shabbas-manage.ts index 3fbad34..3ea1026 100644 --- a/src/firebase/shabbas-manage.ts +++ b/src/firebase/shabbas-manage.ts @@ -360,4 +360,10 @@ export const resumeShabbas = async (msg: Message) => { client.sendMessage(msg.from, `הרישום ממשיך`); }; -const alertSubscribers = async (msg: Message) => {}; +export const sendAll = async (msg: string) => { + const docs = await getDocs(query(collection(fireStore, "/users"))); + + docs.forEach((doc) => { + client.sendMessage(doc.data().phone, msg); + }); +}; diff --git a/src/message-handler.ts b/src/message-handler.ts index 7ef9f2e..c6bd8a7 100644 --- a/src/message-handler.ts +++ b/src/message-handler.ts @@ -17,6 +17,7 @@ import { getAlcoholics, closeShabbas, resumeShabbas, + sendAll, } from "./firebase/shabbas-manage"; import { HELP_MESSAGE } from "./constants/help-message"; import { sendSpecialMessages } from "./constants/special-response"; @@ -114,12 +115,16 @@ export const messageHandler = async (msg: Message) => { await closeShabbas(msg); return; } - + if (msg.body.startsWith("!resume") && (await isAdmin(msg))) { await resumeShabbas(msg); return; } + //Added the /all for the gamers there😁 + if (msg.body.startsWith("/all") && (await isAdmin(msg))) { + sendAll(msg.body.split("/all")[1].trim()); + } switch (msg.body) { case "כן": await addUser(msg);