chore: auto-commit from dashboard

This commit is contained in:
2026-04-22 11:05:14 +00:00
parent 51af0918a4
commit bfc2283e6f
7 changed files with 103 additions and 46 deletions

View File

@@ -916,3 +916,29 @@
[2026-04-21 10:04:32] HASH CHANGED in SIT_FIN_AN_2025 (no version changes detected)
[2026-04-21 10:04:32] OK: DESCARCARE_DECLARATII
[2026-04-21 10:04:32] === Monitor complete ===
[2026-04-21 16:00:00] === Starting ANAF monitor v2.1 ===
[2026-04-21 16:00:00] OK: D100
[2026-04-21 16:00:00] OK: D101
[2026-04-21 16:00:00] OK: D300
[2026-04-21 16:00:00] OK: D390
[2026-04-21 16:00:00] OK: D394
[2026-04-21 16:00:00] OK: D205
[2026-04-21 16:00:01] OK: D406
[2026-04-21 16:00:01] OK: BILANT_2025
[2026-04-21 16:00:01] OK: SIT_FIN_SEM_2025
[2026-04-21 16:00:01] OK: SIT_FIN_AN_2025
[2026-04-21 16:00:01] OK: DESCARCARE_DECLARATII
[2026-04-21 16:00:01] === Monitor complete ===
[2026-04-22 10:00:00] === Starting ANAF monitor v2.1 ===
[2026-04-22 10:00:00] OK: D100
[2026-04-22 10:00:00] OK: D101
[2026-04-22 10:00:00] OK: D300
[2026-04-22 10:00:03] OK: D390
[2026-04-22 10:00:03] OK: D394
[2026-04-22 10:00:03] OK: D205
[2026-04-22 10:00:03] OK: D406
[2026-04-22 10:00:04] OK: BILANT_2025
[2026-04-22 10:00:04] OK: SIT_FIN_SEM_2025
[2026-04-22 10:00:04] OK: SIT_FIN_AN_2025
[2026-04-22 10:00:04] OK: DESCARCARE_DECLARATII
[2026-04-22 10:00:04] === Monitor complete ===

View File

@@ -88,6 +88,25 @@ def send_whatsapp(to: str, text: str) -> bool:
return False
def send_discord_webhook(text: str) -> bool:
"""Trimite mesaj pe Discord via webhook (max 2000 chars per mesaj)."""
config = Config(PROJECT_ROOT / "config.json")
url = config.get("discord.email_webhook_url", "")
if not url:
return False
try:
chunks = [text[i:i+2000] for i in range(0, len(text), 2000)]
for chunk in chunks:
resp = requests.post(url, json={"content": chunk}, timeout=15)
if resp.status_code not in (200, 204):
print(f"[discord webhook] status {resp.status_code}", file=sys.stderr)
return False
return True
except Exception as e:
print(f"[discord webhook eroare] {e}", file=sys.stderr)
return False
def send_whatsapp_document(to: str, filepath: str) -> bool:
"""Trimite un fișier ca document WhatsApp prin bridge."""
try:
@@ -145,6 +164,12 @@ def run_digest():
else:
print(f"❌ Trimitere eșuată: {subject}")
ok_dc = send_discord_webhook(summary)
if ok_dc:
print(f"✅ Trimis pe Discord: {subject}")
else:
print(f"❌ Discord eșuat: {subject}")
for att_path in attachment_paths:
ok_att = send_whatsapp_document(owner_jid, att_path)
name = Path(att_path).name

View File

@@ -117,6 +117,25 @@ def send_whatsapp(to: str, text: str) -> bool:
return False
def send_discord_webhook(text: str) -> bool:
"""Trimite mesaj pe Discord via webhook (max 2000 chars per mesaj)."""
config = Config(PROJECT_ROOT / "config.json")
url = config.get("discord.email_webhook_url", "")
if not url:
return False
try:
chunks = [text[i:i+2000] for i in range(0, len(text), 2000)]
for chunk in chunks:
resp = requests.post(url, json={"content": chunk}, timeout=15)
if resp.status_code not in (200, 204):
print(f"[discord webhook] status {resp.status_code}", file=sys.stderr)
return False
return True
except Exception as e:
print(f"[discord webhook eroare] {e}", file=sys.stderr)
return False
def send_whatsapp_document(to: str, filename: str, data: bytes) -> bool:
try:
mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"
@@ -212,6 +231,13 @@ def run_forward():
else:
print(f"Trimis pe WhatsApp ({len(parts)} mesaje): {subject}")
full_text = "\n".join(parts)
ok_dc = send_discord_webhook(full_text)
if ok_dc:
print(f"Trimis pe Discord: {subject}")
else:
print(f"Discord eșuat: {subject}")
for fname, fdata in em.get('attachment_data', {}).items():
ok_att = send_whatsapp_document(owner_jid, fname, fdata)
if ok_att: