completion_text = (
            "✅ SMS Bombing Complete!\n"
            f"📱 Number: {phone_number}\n"
            f"📝 Message: {msg_text}\n"
            f"🔄 Total Attempts: {repeat_count}\n"
            "📊 Final Results:\n"
            f"\nAll {repeat_count} messages sent successfully!\n"
            "\nCredits To @Nighative"
        )
        bot.send_message(message.chat.id, completion_text)
        del user_sms_data[user_id]
    except Exception as e:
        bot.reply_to(message, f"An error occurred: {str(e)}")
@bot.message_handler(commands=['start'])
def start_command(message):
    user_id = str(message.from_user.id)
    if not is_user_authorized(user_id):
        bot.send_message(message.chat.id, 
            "👋 Welcome to Logs Generator Bot!\n\n"
            "🔐 You need to redeem a key to use this bot\n"
            "📝 Use /redeem to activate your access\n\n"
            "💡 Need a key? Contact @anetjaka"
        )
        return
def count_active_users():
    keys = load_keys()
    current_time = datetime.now()
    active_users_count = 0
    for key, key_info in keys.items():
        if 'redeemed' in key_info and key_info['redeemed']:
            expiry_date = datetime.fromisoformat(key_info['expires_at'])
            if current_time <= expiry_date and not key_info.get('expired', False):
                active_users_count += 1
    return active_users_count
@bot.message_handler(commands=['status'])
def status_command(message):
    user_id = str(message.from_user.id)
    if not is_user_authorized(user_id):
        bot.send_message(message.chat.id, 
            "⛔ Access Forbidden\n\n"
            "Please redeem a key first using /redeem\n"
            "Need a key? Contact @anetjaka"
        )
        return
    keys = load_keys()
    users = load_users()
    user_info = users.get(user_id, {})
    if not user_info or 'redeemed_key' not in user_info:
        bot.send_message(message.chat.id, "❌ No active key found.")
        return
    redeemed_key = user_info['redeemed_key']
    key_info = keys.get(redeemed_key, {})
    now = datetime.now()
    if 'expires_at' in key_info:
        try:
            expiry_date = datetime.fromisoformat(key_info['expires_at'])
            if now > expiry_date:
                bot.send_message(message.chat.id, 
                    "🚨 KEY EXPIRED 🚨\n\n"
                    f"📇 User ID: {user_id}\n"
                    f"⏰ Expiration: {key_info['expires_at']}\n\n"
                    "🔑 Your key has expired\n"
                    "💡 DM @anetjaka to renew your access", 
                    parse_mode='Markdown'
                )
                return
            time_remaining = expiry_date - now
            days = time_remaining.days
            hours, remainder = divmod(time_remaining.seconds, 3600)
            minutes, seconds = divmod(remainder, 60)
            search_count_data = load_search_count()
            total_searches = search_count_data.get('total_searches', 0)
            total_active_users = count_active_users()
            bot.send_message(message.chat.id, 
                "📊 Status Information\n"
                "━━━━━━━━━━━━━━━\n\n"
                f"👤 User ID: {user_id}\n\n"
                "⏳ Time Remaining:\n"
                f"   • {days} days\n"
                f"   • {hours} hours\n"
                f"   • {minutes} minutes\n\n"
                f"🔎 Total Searches: {total_searches}\n"
                f"👥 Active Users: {total_active_users}\n"  # New line showing active users
                f"📅 Key Redeemed: {user_info.get('redeemed_at', 'N/A')}\n"
                f"⌛ Expires: {key_info['expires_at']}\n\n"
                "⚠️ Renew your key before expiration\n"
                "💡 Contact @anetjaka for renewal",
                parse_mode='Markdown'
            )