Refactor send_webhook function to improve logging
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user