1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-07-25 23:51:32 +00:00

updated standard reply for tickers in text

This commit is contained in:
2019-05-27 09:18:24 -07:00
parent bfca21f176
commit 3113c17efb
2 changed files with 26 additions and 65 deletions

23
bot.py
View File

@@ -38,30 +38,17 @@ def tickerDetect(bot, update):
"""
message = update.message.text
chat_id = update.message.chat_id
# Let user know bot is working
bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING)
tickers = getTickers(message)
data = tickerData(tickers) if tickers else {}
# Let user know bot is working
if tickers:
bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING)
replies = tickerDataReply(tickers)
for ticker in data:
for symbol, reply in replies.items():
# Keep track of which tickers had a return from tickerData()
if ticker.lower() in tickers:
tickers.remove(ticker.lower())
reply = tickerDataReply(data[ticker])
update.message.reply_text(text=reply, parse_mode=telegram.ParseMode.MARKDOWN)
# For any tickers that didnt have data, return that they don't exist.
for ticker in tickers:
update.message.reply_text(
ticker.upper()
+ " does not exist, you should search for a real stock like $PSEC"
)
def news(bot, update):
"""