diff --git a/IEX_Symbol.py b/IEX_Symbol.py index cfd13d3..40038a0 100644 --- a/IEX_Symbol.py +++ b/IEX_Symbol.py @@ -36,6 +36,9 @@ class IEX_Symbol: """ try: self.IEX_TOKEN = os.environ["IEX"] + + if self.IEX_TOKEN == "TOKEN": + self.IEX_TOKEN = "" except KeyError: self.IEX_TOKEN = "" warning( @@ -122,6 +125,10 @@ class IEX_Symbol: str Human readable text on status of IEX API """ + + if self.IEX_TOKEN == "": + return "The `IEX_TOKEN` is not set so Stock Market data is not available." + resp = r.get( "https://pjmps0c34hp7.statuspage.io/api/v2/status.json", timeout=15, diff --git a/bot.py b/bot.py index 7b4e538..fca3cec 100644 --- a/bot.py +++ b/bot.py @@ -85,14 +85,17 @@ def license(update: Update, context: CallbackContext): def status(update: Update, context: CallbackContext): """Gather status of bot and dependant services and return important status updates.""" warning(f"Status command ran by {update.message.chat.username}") - bot_resp = datetime.datetime.now(update.message.date.tzinfo) - update.message.date + bot_resp_time = ( + datetime.datetime.now(update.message.date.tzinfo) - update.message.date + ) + + bot_status = s.status( + f"It took {bot_resp_time.total_seconds()} seconds for the bot to get your message." + ) update.message.reply_text( - text=s.status( - f"It took {bot_resp.total_seconds()} seconds for the bot to get your message." - ), + text=bot_status, parse_mode=telegram.ParseMode.MARKDOWN, - disable_notification=True, )