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

Only look at messages with a $

This commit is contained in:
Anson 2021-10-05 15:28:51 -07:00
parent e8aeba478c
commit e08573ff7c

7
bot.py
View File

@ -164,14 +164,17 @@ def symbol_detect(update: Update, context: CallbackContext):
try: try:
message = update.message.text message = update.message.text
chat_id = update.message.chat_id chat_id = update.message.chat_id
symbols = s.find_symbols(message) if "$" in message:
symbols = s.find_symbols(message)
info("Looking for Symbols")
else:
return
except AttributeError as ex: except AttributeError as ex:
info(ex) info(ex)
return return
if symbols: if symbols:
# Let user know bot is working # Let user know bot is working
context.bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING) context.bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING)
info(f"User called for symbols: {update.message.chat.username}")
info(f"Symbols found: {symbols}") info(f"Symbols found: {symbols}")
for reply in s.price_reply(symbols): for reply in s.price_reply(symbols):