selectServer

.selectServer() is used to select a server that you want to edit on the session ID

.selectServer(SessionID, serverCode)

Select a server to edit for a session ID

Parameter

Type

Required

Description

SessionID

string

true

The session of the account you want to select server on

serverCode

string

true

The code of the server you want to select

Example:

// Dependencies
const CubedCraft = require('cubed-api');

// Account Details
const username = 'ACCOUNT_USERNAME';
const password = 'ACCOUNT_PASSWORD';

// Server Details
const serverName = 'SERVER_NAME';

// Logging Into The Account
CubedCraft.login(username, password).then(ses => {

    // Getting All Of The User's Servers With Their Session ID
    CubedCraft.getServers(ses).then(servers => {
        const server = servers.find(s => s.name.toLowerCase() === serverName.toLowerCase());
        console.log(server.code);
    })
    
});

Last updated

Was this helpful?