Adaugă trimitere ZIP pe email și elimină emoji-uri din mesaje
- /scrape_zip trimite ZIP pe ambele canale (Telegram + email) - /zip trimite ZIP și pe email, nu doar pe Telegram - Elimină emoji-uri din mesajele Telegram user-facing - Adaugă ghid "NO EMOJIS" în CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,8 @@ from datetime import datetime
|
||||
import glob
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
from config import Config
|
||||
from notifications import EmailNotifier
|
||||
|
||||
# Load environment
|
||||
load_dotenv()
|
||||
@@ -238,7 +240,7 @@ class TelegramTriggerBot:
|
||||
return
|
||||
|
||||
# Construiește mesaj cu solduri
|
||||
caption = f"📦 *BTGO Export (ZIP)*\n\n"
|
||||
caption = f"*BTGO Export (ZIP)*\n\n"
|
||||
caption += f"Timp: {datetime.fromtimestamp(solduri_time).strftime('%Y-%m-%d %H:%M:%S')}\n"
|
||||
caption += f"Dimensiune: {zip_size:.2f} MB\n"
|
||||
caption += f"Fișiere: {len(files_to_zip)}\n\n"
|
||||
@@ -256,7 +258,7 @@ class TelegramTriggerBot:
|
||||
caption += f"Conturi: {len(transaction_files)}"
|
||||
|
||||
# Trimite ZIP-ul
|
||||
self.send_message(chat_id, "📦 *Creare arhivă ZIP...*", reply_to_message_id)
|
||||
self.send_message(chat_id, "*Creare arhivă ZIP...*", reply_to_message_id)
|
||||
|
||||
url = f"{self.base_url}/sendDocument"
|
||||
with open(zip_path, 'rb') as f:
|
||||
@@ -277,6 +279,21 @@ class TelegramTriggerBot:
|
||||
logging.error(f"Eroare trimitere ZIP: {response.text}")
|
||||
self.send_message(chat_id, f"*EROARE*\n\nNu s-a putut trimite arhiva.", reply_to_message_id)
|
||||
|
||||
# Trimite și pe email dacă este configurat
|
||||
try:
|
||||
config = Config()
|
||||
if config.EMAIL_ENABLED:
|
||||
email_notifier = EmailNotifier(config)
|
||||
logging.info("Trimitere ZIP pe email...")
|
||||
if email_notifier.send_existing_zip(zip_path, accounts_data):
|
||||
logging.info("✓ ZIP trimis cu succes pe email")
|
||||
else:
|
||||
logging.warning("Nu s-a putut trimite ZIP-ul pe email")
|
||||
else:
|
||||
logging.info("Email notifications disabled - skipping email")
|
||||
except Exception as e:
|
||||
logging.error(f"Eroare trimitere ZIP pe email: {e}")
|
||||
|
||||
# Șterge fișierul ZIP temporar
|
||||
zip_path.unlink()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user