feat: notifikasi admin/monitoring via Telegram (WA fallback); alert staff dialihkan ke Telegram

This commit is contained in:
oxpoe committed 2026-10-09 09:23:06 +07:00
1 parent 52f6be26d1
commit e838645531
7 files changed
+35 -9

No files matched your search

+15 -1
View File
@@ -998,4 +998,18 @@ function initTelegram() {
}
// Export for manual re-init from settings
module.exports = { initTelegram };
async function notifyAdmin(text) {
try {
const adminId = String(getSetting('telegram_admin_id', '') || '').trim();
if (!bot || !adminId || !text) return false;
const ids = adminId.split(/[,s]+/).filter(Boolean);
let ok = false;
for (const id of ids) {
try { await bot.sendMessage(id, text, { parse_mode: 'Markdown' }); ok = true; }
catch (e) { try { await bot.sendMessage(id, String(text)); ok = true; } catch (e2) {} }
}
return ok;
} catch (e) { return false; }
}
module.exports = { initTelegram, notifyAdmin };