diff --git a/transcription_bot/handlers.py b/transcription_bot/handlers.py index 703ebe7..7b1760a 100644 --- a/transcription_bot/handlers.py +++ b/transcription_bot/handlers.py @@ -42,13 +42,13 @@ def _transcription_log_and_notify_email(action: str, error_details: str): import smtplib from email.mime.text import MIMEText msg = MIMEMultipart() - msg['From'] = str(getattr(config.config, 'DEFAULT_EMAIL_FROM', 'bot@noreply.com')) - to_emails = getattr(config.config, 'ALERTS_SUPPORT_EMAILS', ['admin@example.com']) + msg['From'] = str(getattr(config, 'DEFAULT_EMAIL_FROM', 'bot@noreply.com')) + to_emails = getattr(config, 'ALERTS_SUPPORT_EMAILS', ['admin@example.com']) msg['To'] = ', '.join(to_emails) if isinstance(to_emails, list) else str(to_emails) msg['Subject'] = f'TrueConf Bot Error: Транскрипция - {action}' body = f'Обнаружена ошибка в транскрипции.\nВремя: {timestamp}\nДействие: {action}\nДетали:\n{error_details}' msg.attach(MIMEText(body, 'plain', 'utf-8')) - with smtplib.SMTP(getattr(config.config, 'SMTP_SERVER', 'localhost'), int(getattr(config.config, 'SMTP_PORT', 25))) as server: + with smtplib.SMTP(getattr(config, 'SMTP_SERVER', 'localhost'), int(getattr(config, 'SMTP_PORT', 25))) as server: server.send_message(msg) except Exception: pass @@ -163,3 +163,4 @@ async def transcription_handler(msg: Message): +