Refactor send_webhook function to improve logging

This commit is contained in:
2025-04-23 16:14:48 +02:00
parent 8c0916f6b4
commit 7341087071

@ -1165,14 +1165,15 @@ def send_webhook(custom_url: str = "", message: str = "") -> None:
custom_url: The custom webhook URL to send the message to. If not provided, uses the WEBHOOK_URL environment variable.
message: The message that will be sent to Discord.
"""
logger.info(f"Sending webhook to '{custom_url}' with message: '{message}'")
webhook_url: str = os.getenv("WEBHOOK_URL", default="")
url: str = custom_url or webhook_url
logger.info(f"Sending webhook to '{url}' with message: '{message}'")
if not message:
logger.error("No message provided.")
message = "No message provided."
webhook_url: str = os.getenv("WEBHOOK_URL", default="")
url: str = custom_url or webhook_url
if not url:
logger.error("No webhook URL provided.")
return