Selecting a server to work on
Logging in is probably not enough. You need to select a server to be able to work on something. Luckily we got you covered!
Getting a server its code
In order to select a server, we first need to figure out what the server code is. The server code is unique to each server and will be used for choosing a server.
The following code can be used to get all servers the user has access to:
// Dependencies
const { Session } = require('cubed-session');
(async () => {
// Starting a new session
const session = new Session();
// Logging in
await session.login('username', 'password');
const servers = await session.getServers();
console.log(servers);
})()The following code will log every server the user that is logged in has access to in the console. I am using async/await but you can also use a different method.
Selecting a server
Now to select a server to edit or do actions on the server, we need to specify the server we need. We can do so by finding the server we need, and then grabbing its code
If you run the code and no errors occur, you successfully selected your server! You can now send instructions to it.
Last updated
Was this helpful?