diff --git a/app.py b/app.py index 5591411..9b8a403 100644 --- a/app.py +++ b/app.py @@ -56,7 +56,7 @@ # Print the price and location data print("\nBest " + str(type) + " price: ", price, "\nLocated at: ", str(loc)) - # Send alert on price change + # Add alert to content on price change if price != float(priceDataFile[type]): if price > float(priceDataFile[type]): content += ":arrow_up:\t\t" @@ -72,6 +72,9 @@ + "\n\n" ) + # Add price from API to price data file + priceDataFile[type] = price + # Post any price changes to webhook if content != "": content += ( @@ -81,8 +84,6 @@ ) requests.post(webhookURL, data={"content": content}) - priceDataFile[type] = price - # Write the current price to the JSON file with open("data/priceData.json", "w") as file: json.dump(priceDataFile, file)