Skip to content

Commit

Permalink
Merge pull request #24 from Luois45/dev
Browse files Browse the repository at this point in the history
Fixed crash on sending discord webhook
  • Loading branch information
Louis_45 authored Apr 1, 2024
2 parents 74665b1 + 0a92c02 commit bb26e20
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions skinbaron.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ def matches_pattern(value, pattern):

def send_discord_embed(items: list, total):
"""Send an embed to Discord containing bought items information."""
webhook_url = config.get("discord_webhook")

# If webhook_url is None or empty, return early
if not webhook_url:
if not config.discord_webhook:
logging.warning("Discord webhook URL not found in config. Skipping sending message to Discord.")
return

Expand All @@ -43,7 +41,7 @@ def send_discord_embed(items: list, total):
'Content-Type': 'application/json',
}

response = requests.post(webhook_url, json=payload, headers=headers)
response = requests.post(config.discord_webhook, json=payload, headers=headers)

# Log an error if the request failed
if response.status_code != 204:
Expand Down

0 comments on commit bb26e20

Please sign in to comment.