Enhance status command with verbose and useful information

This commit is contained in:
2024-08-18 13:24:06 -05:00
parent 8179937d06
commit 4db613f750
+37 -1
View File
@@ -129,7 +129,43 @@ async def switch_providers(update: Update, context: ContextTypes.DEFAULT_TYPE) -
await update.message.reply_text(f"Switched to {new_provider_name} provider")
async def status(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
await update.message.reply_text(f"Currently using {ai_provider.__class__.__name__}: {ai_provider.get_model()}")
global ai_provider, conversation_history, tools
provider_name = ai_provider.__class__.__name__
model = ai_provider.get_model()
total_conversations = sum(len(history) for history in conversation_history.values())
active_users = len(conversation_history)
available_tools = [tool.__class__.__name__ for tool in tools]
status_message = f"""
🤖 Bot Status Report 🤖
AI Provider: {provider_name}
Current Model: {model}
📊 Usage Statistics:
• Total Conversations: {total_conversations}
• Active Users: {active_users}
🛠 Available Tools ({len(available_tools)}):
{', '.join(available_tools)}
💡 Commands:
• /start - Start the bot
• /clear - Clear conversation history
• /switch - Switch AI model (OpenAI only)
• /toggle - Toggle between AI providers
• /status - Show this status report
🔧 System Info:
• Python version: {os.sys.version.split()[0]}
• Telegram Bot API version: {Application.VERSION}
"""
logging.info("Status command executed")
await update.message.reply_text(status_message)
def main() -> None:
# Create the Application and pass it your bot's token