from handlers.topup import handle_topup_message
from handlers.start import (
    show_products, show_balance,
    show_topup, show_panduan, show_kontak
)

user_data = {}

async def handle_message(bot, message):
    text = message.text
    user_id = message.sender_id

    if user_data.get(user_id, {}).get("awaiting_topup"):
        await handle_topup_message(bot, message, user_data)
        return

    routes = {
        "🛍 Produk": show_products,
        "💰 Saldo": show_balance,
        "💳 Topup": show_topup,
        "📖 Panduan": show_panduan,
        "📞 Kontak Admin": show_kontak,
    }

    handler = routes.get(text)
    if handler:
        await handler(bot, message)