From c5b56bb345ad23854c0efbf22332f586cc907b3b Mon Sep 17 00:00:00 2001 From: Anson Date: Sun, 15 Aug 2021 20:07:32 -0700 Subject: [PATCH] clean up logs (cherry picked from commit 1bbbaa5f4e00d8ed8bc4d8de690dce52284521db) --- bot.py | 12 +++++++----- symbol_router.py | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index e77b6cf..06e8948 100644 --- a/bot.py +++ b/bot.py @@ -161,11 +161,13 @@ def symbol_detect(update: Update, context: CallbackContext): Runs on any message that doesn't have a command and searches for symbols, then returns the prices of any symbols found. """ - - message = update.message.text - chat_id = update.message.chat_id - symbols = s.find_symbols(message) - + try: + message = update.message.text + chat_id = update.message.chat_id + symbols = s.find_symbols(message) + except AttributeError as ex: + info(ex) + return if symbols: # Let user know bot is working context.bot.send_chat_action(chat_id=chat_id, action=telegram.ChatAction.TYPING) diff --git a/symbol_router.py b/symbol_router.py index dad9a82..9fef243 100644 --- a/symbol_router.py +++ b/symbol_router.py @@ -51,7 +51,10 @@ class Router: symbols.append(Coin(coin.lower())) else: info(f"{coin} is not in list of coins") - info(symbols) + + if symbols: + info(symbols) + return symbols def status(self, bot_resp) -> str: