const { RouterOSClient } = require('routeros-client');

async function test() {
  const host = "sg-6.hostddns.us";
  const port = 47808;
  const user = "mymikrobil";
  const pass = "241020";

  try {
    const client = new RouterOSClient({
      host: host,
      port: port,
      user: user,
      password: pass,
      timeout: 10,
      keepalive: false
    });
    await client.connect();
    console.log("Connected!");

    const users = await client.api().menu("/ip/hotspot/user").get();
    
    const ourUser = users.find(u => String(u.name).startsWith("le"));
    const otherUser = users.find(u => !String(u.name).startsWith("le"));

    console.log("\nProperties of OUR user (starts with 'le'):");
    console.log(JSON.stringify(ourUser, null, 2));

    console.log("\nProperties of OTHER user:");
    console.log(JSON.stringify(otherUser, null, 2));

    await client.close();
  } catch (err) {
    console.log("Error:", err.message);
  }
}

test();
