feat: Enable (or not) email or Telegram notifications

This commit is contained in:
kbe
2025-07-20 03:47:12 +02:00
parent 1fd4463314
commit 35160bc033
3 changed files with 29 additions and 6 deletions

View File

@@ -91,13 +91,22 @@ class CrossFitBooker:
"to": os.environ.get("EMAIL_TO"),
"password": os.environ.get("EMAIL_PASSWORD")
}
telegram_credentials = {
"token": os.environ.get("TELEGRAM_TOKEN"),
"chat_id": os.environ.get("TELEGRAM_CHAT_ID")
}
self.notifier = SessionNotifier(email_credentials, telegram_credentials)
# Get notification settings from environment variables
enable_email = os.environ.get("ENABLE_EMAIL_NOTIFICATIONS", "true").lower() in ("true", "1", "yes")
enable_telegram = os.environ.get("ENABLE_TELEGRAM_NOTIFICATIONS", "true").lower() in ("true", "1", "yes")
self.notifier = SessionNotifier(
email_credentials,
telegram_credentials,
enable_email=enable_email,
enable_telegram=enable_telegram
)
def get_auth_headers(self) -> Dict[str, str]:
"""