From 54fa3bcc4ac0ebbc90a22c2c8ae72bd7ffac1f7f Mon Sep 17 00:00:00 2001 From: Mike Shultz Date: Mon, 4 May 2020 17:29:47 -0600 Subject: [PATCH] delete command message for /price --- bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.py b/bot.py index 3fd4728..0cb43c2 100644 --- a/bot.py +++ b/bot.py @@ -259,6 +259,8 @@ class TelegramMonitorBot: if CMC_API_KEY is not None: self.available_commands.append('price') + print('Available commands: {}'.format(', '.join(self.available_commands))) + # Cached token prices self.cached_prices = {} @@ -557,6 +559,7 @@ class TelegramMonitorBot: """ chat_id = None command = None + message_id = update.effective_message.message_id command = command_from_message(update.effective_message) @@ -595,8 +598,15 @@ class TelegramMonitorBot: monetary_format(pdata.volume), update.effective_user.username, ) + bot.send_message(chat_id, message, parse_mode=telegram.ParseMode.MARKDOWN) + # Delete the command message + try: + bot.delete_message(chat_id, message_id) + except Exception: + # nbd if we cannot delete it + pass def error(self, bot, update, error): """ Log Errors caused by Updates. """