From 2eff52fd68d9a0ecb37d84e22657e0042fe3a94b Mon Sep 17 00:00:00 2001 From: Dima Marhitych Date: Sun, 31 Dec 2023 22:36:38 +0100 Subject: [PATCH] Update webhook --- discord/discord_req.txt | 1 + discord/send_webhook.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/discord/discord_req.txt b/discord/discord_req.txt index dd7659a..af2ff27 100644 --- a/discord/discord_req.txt +++ b/discord/discord_req.txt @@ -1,2 +1,3 @@ fusion-engine discord_webhook +python-dotenv diff --git a/discord/send_webhook.py b/discord/send_webhook.py index 069813b..f0d91e2 100644 --- a/discord/send_webhook.py +++ b/discord/send_webhook.py @@ -1,22 +1,22 @@ from discord_webhook import DiscordWebhook import fusionengine as fusion +from dotenv import load_dotenv import os - -def send_discord_webhook(message): - if webhook := os.environ.get("FUSION_WEBHOOK"): - DiscordWebhook(url=webhook, content=message).execute() - else: - print("Discord webhook URL not found in environment variables.") - +load_dotenv() version = fusion.__version__ author = fusion.__author__ message = f"Fusion Engine {version} of package has been released to PyPI by {author}! Check it out at https://pypi.org/project/fusion-engine/{version}" -print("Sending webhook...") +if webhook := os.getenv("FUSION_WEBHOOK"): + print("Sending webhook...") + + DiscordWebhook(url=webhook, content=message).execute() -send_discord_webhook(message) + print("Webhook sent!") + +else: + print("Discord webhook URL not found in environment variables.") -print("Webhook sent!")