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:
parent
d84324c818
commit
f7c10209c3
@ -45,8 +45,14 @@ def news(bot, update):
|
|||||||
|
|
||||||
## Checks if a ticker was passed in
|
## Checks if a ticker was passed in
|
||||||
if tickers == []:
|
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(
|
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:
|
else:
|
||||||
tickerData = tickerInfo.tickerQuote(tickers)
|
tickerData = tickerInfo.tickerQuote(tickers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user