diff --git a/stock/util/TelegramBot.py b/stock/util/TelegramBot.py index 69cdc59..678527f 100644 --- a/stock/util/TelegramBot.py +++ b/stock/util/TelegramBot.py @@ -1,5 +1,6 @@ from datetime import datetime import telegram +import asyncio from multiprocessing import Pool class TelegramBot: @@ -35,9 +36,9 @@ class TelegramBot: @staticmethod def send(text): - client = telegram.Bot(token="6435061393:AAHOh9wB5yGNGUdb3SfCYJrrWTBe7wgConM") + client = telegram.Bot(token="6874078562:AAEHxGDavfc0ssAXPQIaW8JGYmTR7LNUJOw") #client.sendMessage(chat_id='574661323', text=text) - client.send_message(chat_id='574661323', text=text) + asyncio.run(client.send_message(chat_id='574661323', text=text)) return def alarm_live(self, stock_code, stock_name): @@ -80,3 +81,5 @@ if __name__ == "__main__": telegramBot = TelegramBot() telegramBot.alarm_live(stock_code, stock_name) telegramBot.post(stock_code, stock_name, type, price, count) + +