소스 검색

Add mentions and id to stock forecast

Foppe Hemminga 5 년 전
부모
커밋
d7408dbd33
2개의 변경된 파일13개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 2
      main.py
  2. 3 2
      view.py

+ 10 - 2
main.py

@@ -68,10 +68,18 @@ def process_forecast(this_stock):
     current_price = float(data_latest.current_price)
     quantity = data_latest.available_shares - data_previous.available_shares
     stock_name = this_stock[0]
+    stock_id = this_stock[5]
     current_quantity = data_latest.available_shares
     message = view.create_message(
-        stock_name, timestamp_latest, current_price, quantity, current_quantity,
-        forecast_previous, forecast_latest, False)
+        stock_name,
+        timestamp_latest,
+        current_price,
+        quantity,
+        current_quantity=current_quantity,
+        forecast_previous=forecast_previous,
+        forecast_latest=forecast_latest,
+        npc_drop=False,
+        stock_id=stock_id)
     print(message)
     if is_forecast_changed:
         view.broadcast(message)

+ 3 - 2
view.py

@@ -6,8 +6,9 @@ import json
 base_url = 'https://discordapp.com/api/webhooks/'
 
 
-def create_message(name, timestamp, price, quantity, current_quantity=0, forecast_previous="",
-                   forecast_latest="", npc_drop=False, stock_id=""):
+def create_message(name, timestamp, price, quantity, current_quantity=0,
+                   forecast_previous="", forecast_latest="", npc_drop=False,
+                   stock_id=""):
     """
     Creates the string to be broadcast
     :param name: