diff --git a/bot/telegram_bot.py b/bot/telegram_bot.py index 4971446..9d47cef 100644 --- a/bot/telegram_bot.py +++ b/bot/telegram_bot.py @@ -100,29 +100,41 @@ class ChatGPTTelegramBot: chat_messages, chat_token_length = self.openai.get_conversation_stats(chat_id) remaining_budget = get_remaining_budget(self.config, self.usage, update) bot_language = self.config['bot_language'] + text_current_conversation = ( f"*{localized_text('stats_conversation', bot_language)[0]}*:\n" f"{chat_messages} {localized_text('stats_conversation', bot_language)[1]}\n" f"{chat_token_length} {localized_text('stats_conversation', bot_language)[2]}\n" f"----------------------------\n" ) + + text_today_images = "" + if self.config.get('enable_image_generation', False): + text_today_images = f"{images_today} {localized_text('stats_images', bot_language)}\n" + text_today = ( f"*{localized_text('usage_today', bot_language)}:*\n" f"{tokens_today} {localized_text('stats_tokens', bot_language)}\n" - f"{images_today} {localized_text('stats_images', bot_language)}\n" + f"{text_today_images}" # <- Incorporamos la variable que contiene el texto de imágenes f"{transcribe_minutes_today} {localized_text('stats_transcribe', bot_language)[0]} " f"{transcribe_seconds_today} {localized_text('stats_transcribe', bot_language)[1]}\n" f"{localized_text('stats_total', bot_language)}{current_cost['cost_today']:.2f}\n" f"----------------------------\n" ) + + text_month_images = "" + if self.config.get('enable_image_generation', False): + text_month_images = f"{images_month} {localized_text('stats_images', bot_language)}\n" + text_month = ( f"*{localized_text('usage_month', bot_language)}:*\n" f"{tokens_month} {localized_text('stats_tokens', bot_language)}\n" - f"{images_month} {localized_text('stats_images', bot_language)}\n" + f"{text_month_images}" # <- Incorporamos la variable que contiene el texto de imágenes f"{transcribe_minutes_month} {localized_text('stats_transcribe', bot_language)[0]} " f"{transcribe_seconds_month} {localized_text('stats_transcribe', bot_language)[1]}\n" f"{localized_text('stats_total', bot_language)}{current_cost['cost_month']:.2f}" ) + # text_budget filled with conditional content text_budget = "\n\n" budget_period = self.config['budget_period']