From f7c10209c3089e4c9f075a42215d4fb6392ddcc8 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 12 Feb 2019 20:09:41 -0700 Subject: [PATCH] Bot now provides market news when no ticker is called with /news --- bot/stockBot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot/stockBot.py b/bot/stockBot.py index c50fe85..36f8ece 100644 --- a/bot/stockBot.py +++ b/bot/stockBot.py @@ -45,8 +45,14 @@ def news(bot, update): ## Checks if a ticker was passed in if tickers == []: + message = "No Ticker, showing Market News:" + news = tickerInfo.stockNews("market") + for i in range(3): + message = "{}\n\n[{}]({})".format( + message, news["title"][i], news["link"][i] + ) update.message.reply_text( - "Please type a ticker after your command with a dollar sign: /news $tsla" + text=message, parse_mode=telegram.ParseMode.MARKDOWN ) else: tickerData = tickerInfo.tickerQuote(tickers)