Added DISCORD_NOTIFICATION_CURRENCY env var

This commit is contained in:
2025-07-12 13:05:52 +00:00
parent af86d4aa8f
commit c5a280d911
4 changed files with 27 additions and 21 deletions

View File

@ -2,7 +2,7 @@ import time
import logging
import requests
from env_config import (
DISCORD_WEBHOOK_URL, DISCORD_SERVER_NAME, DISCORD_ROLE_MAP, TEST_MODE,
DISCORD_WEBHOOK_URL, DISCORD_SERVER_NAME, DISCORD_ROLE_MAP, TEST_MODE, DISCORD_NOTIFICATION_CURRENCY,
in_stock_title, out_of_stock_title, sku_change_title,
buy_now, price_label, time_label, footer, sku_description, imminent_drop
)
@ -13,6 +13,7 @@ THUMBNAIL = "https://git.djeex.fr/Djeex/nvidia-stock-bot/raw/branch/main/assets/
# In stock
def send_discord_notification(gpu_name, product_link, products_price):
timestamp = int(time.time())
currency = DISCORD_NOTIFICATION_CURRENCY
if TEST_MODE:
logging.info(f"[TEST MODE] Notification: {gpu_name} available!")
return
@ -23,7 +24,7 @@ def send_discord_notification(gpu_name, product_link, products_price):
"thumbnail": {"url": THUMBNAIL},
"author": {"name": "Nvidia Founder Editions"},
"fields": [
{"name": price_label, "value": f"`{products_price}`", "inline": True},
{"name": price_label, "value": f"`{currency}{products_price}`", "inline": True},
{"name": time_label, "value": f"<t:{timestamp}:d> <t:{timestamp}:T>", "inline": True}
],
"description": buy_now.format(product_link=product_link),