1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-06-16 15:06:53 +00:00

Bot now provides market news when no ticker is called with /news

This commit is contained in:
Anson 2019-02-12 20:09:41 -07:00
parent d84324c818
commit f7c10209c3

View File

@ -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)