orderServers
.orderServers() is used to order the servers object into an order of most players to least.
.orderServers(servers)
Order the servers object from most online players to least.
Parameter
Type
Required
Description
servers
object/array
true
The servers to be ordered
Example:
// Dependencies
const CubedCraft = require('cubed-api');
// Getting the online servers
CubedCraft.API.servers().then(servers => {
// Ordering the servers
CubedCraft.utils.orderServers(servers).then(orderedServers => {
// Logging the server with most online players to console
console.log('Number one player server:');
console.log(orderedServers[0]);
})
})
Last updated
Was this helpful?