Reading from console
There are 2 ways to read from the CubedCraft console. Both will be explained
Using the console event
// Dependencies
const { Session } = require('cubed-session');
(async () => {
// Starting a new session
const session = new Session({ listenConsole: true });
// Logging in
await session.login('username', 'password');
// Getting a list of all servers and finding the one we need
const servers = await session.getServers();
const server = servers.find(s => s.name.toLowerCase() === "Server_Name".toLowerCase());
// Selecting the server
await session.selectServer(server.code);
// Listening for the event
session.on('console', (text) => console.log(text));
})()Using the getConsole method
Last updated