diff --git a/bot.py b/bot.py index 2b654f9..c240618 100644 --- a/bot.py +++ b/bot.py @@ -242,6 +242,7 @@ def intra(update: Update, context: CallbackContext): text="Invalid symbol please see `/help` for usage details.", parse_mode=telegram.ParseMode.MARKDOWN, ) + return context.bot.send_chat_action( chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO @@ -282,6 +283,7 @@ def chart(update: Update, context: CallbackContext): text="Invalid symbol please see `/help` for usage details.", parse_mode=telegram.ParseMode.MARKDOWN, ) + return context.bot.send_chat_action( chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO @@ -430,7 +432,7 @@ def main(): dp.add_handler(CommandHandler("search", search)) dp.add_handler(CommandHandler("intraday", intra)) dp.add_handler(CommandHandler("intra", intra, run_async=True)) - dp.add_handler(CommandHandler("chart", chart, run_async=True)) + dp.add_handler(CommandHandler("chart", chart)) dp.add_handler(CommandHandler("crypto", crypto)) dp.add_handler(CommandHandler("random", rand_pick)) dp.add_handler(CommandHandler("donate", donate)) diff --git a/functions.py b/functions.py index 9ef27d8..82b1861 100644 --- a/functions.py +++ b/functions.py @@ -99,13 +99,15 @@ _Donations can only be made in a chat directly with @simplestockbot_ return symbols, datetime.now() def iex_status(self): - status = r.get("https://pjmps0c34hp7.statuspage.io/api/v2/status.json").json() + status = r.get("https://pjmps0c34hp7.statuspage.io/api/v2/status.json").json()[ + "status" + ] - if status["status"]["indicator"] == "none": + if status["indicator"] == "none": return "IEX Cloud is currently not reporting any issues with its API." else: return ( - f"{['status']['indicator']}: {['status']['description']}." + f"{status['indicator']}: {status['description']}." + " Please check the status page for more information. https://status.iexapis.com" ) @@ -336,7 +338,7 @@ _Donations can only be made in a chat directly with @simplestockbot_ pass response = r.get( - "https://cloud.iexapis.com/stable/stock/{symbol}/chart/1mm?token={self.IEX_TOKEN}&chartInterval=3&includeToday=false" + f"https://cloud.iexapis.com/stable/stock/{symbol}/chart/1mm?token={self.IEX_TOKEN}&chartInterval=3&includeToday=false" ) if response.status_code == 200: