from neonize.client import NewClient
from neonize.events import MessageEv, ConnectedEv, event

client = NewClient("command_bot.sqlite3")

@client.event(ConnectedEv)
def on_connected(client: NewClient, event: ConnectedEv):
    print(f"✅ Bot connected as {event.device.User}")

@client.event(MessageEv)
def on_message(client: NewClient, event: MessageEv):
    text = event.Message.conversation or ""

    if text.startswith("/"):
        command = text.split()[0][1:]  # Remove /

        if command == "help":
            help_text = """
Available commands:
/help - Show this help
/ping - Pong!
/time - Current time
/info - Bot information
            """
            client.reply_message(help_text, event)

        elif command == "ping":
            client.reply_message("Pong! 🏓", event)

        elif command == "time":
            from datetime import datetime
            now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            client.reply_message(f"🕐 {now}", event)

        elif command == "info":
            info = f"Bot: Neonize Command Bot\nVersion: 1.0"
            client.reply_message(info, event)

client.connect()
event.wait()
