Adaugă progress updates pentru /scrape_zip
Modificări: - telegram_trigger_bot.py: - Păstrează TELEGRAM_CHAT_ID și TELEGRAM_MESSAGE_ID pentru progress - Setează flag SEND_AS_ZIP=true în environment - NU mai dezactivează notificările - notifications.py: - Verifică flag SEND_AS_ZIP din environment - Dacă SEND_AS_ZIP=true, trimite ZIP cu progress updates - Mesajul de progres e editat la fel ca /scrape normal Comportament /scrape_zip: 1. Bot trimite "Scraper pornit (arhiva ZIP)" 2. Scraper rulează și editează mesajul cu progress 3. notifications.py detectează flag-ul SEND_AS_ZIP 4. Trimite ZIP cu solduri în loc de fișiere individuale 5. Editează mesajul final cu detalii despre ZIP 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ Handles email and Discord notifications with file attachments
|
||||
import smtplib
|
||||
import logging
|
||||
import zipfile
|
||||
import os
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
@@ -220,6 +221,13 @@ class TelegramNotifier:
|
||||
logging.info(f"Received telegram_message_id: {telegram_message_id}, telegram_chat_id: {telegram_chat_id}")
|
||||
logging.info(f"Stored progress_message_id: {self.progress_message_id}, progress_chat_id: {self.progress_chat_id}")
|
||||
|
||||
# Check if SEND_AS_ZIP flag is set (from Telegram bot /scrape_zip command)
|
||||
send_as_zip = os.getenv('SEND_AS_ZIP', 'false').lower() == 'true'
|
||||
|
||||
if send_as_zip:
|
||||
logging.info("SEND_AS_ZIP flag detected - sending as ZIP archive")
|
||||
return self._send_with_zip(files, accounts)
|
||||
|
||||
# Check total file size
|
||||
total_size = sum(Path(f).stat().st_size for f in files if Path(f).exists())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user