Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unirest.get("https://api.battlemetrics.com/servers/1631443?include=player")
- .end(function (result) {
- //ch1.sendMessage("Добрый вечер, я диспетчер");
- //console.log(result.status, result.headers, result.body);
- var json = JSON.parse(JSON.stringify(result.body));
- if(result.status != 200) {
- ch1.setName("offline");
- /*ch1.fetchMessage('667393448571305994')
- .then(message => message.edit("Сервер оффлайн :("))
- .catch(console.error);*/
- } else {
- ch1.setName("💹" + json.data.attributes.players + " из " + json.data.attributes.maxPlayers);
- var playersList = "Игроки online:";
- playersList = playersList + json.included[0];
- ch1.fetchMessage('667416042707877903').
- then(message => message.edit("```" + " " +
- json.data.attributes.name + "\n" +
- " ip: " + json.data.attributes.ip + "\n" +
- " Карта: " + json.data.attributes.details.map + "\n" +
- " Игроков онлайн: " + json.data.attributes.players + " из " + json.data.attributes.maxPlayers + "\n" +
- " Статус: " + json.data.attributes.status + "\n" + "\n" + playersList + "```"
- ))
- .catch(console.error);
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement