seishun / node-steam

Interface directly with Steam servers from Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-steam hangs up

SzymonLisowiec opened this issue · comments

My script and your node_modules/steam/example.js not working. Library don't receiving any messages from Steam.

Server list is outdated. Here is my solution to fix it (ty scholtzm)

async function loadServerList() {
    let response = await $.httpGetJson("https://api.steampowered.com/ISteamDirectory/GetCMList/v1/?format=json&cellid=0");
    Steam.servers = [];
    for (const server of response.response.serverlist) {
        let _server = server.split(":");
        Steam.servers.push({ "host": _server[0], "port": _server[1] });
    }
}
commented

where exactly should I put this code?
I have no idea

commented

can someone please help :p

const Steam = require('steam');
const Request = require('request-promise-native');

(async _ => {
    await loadServerList();
    // Your script 
})();

async function loadServerList() {
    let response = await Request('https://api.steampowered.com/ISteamDirectory/GetCMList/v1/?format=json&cellid=0');
    response = JSON.parse(response);
    Steam.servers = [];
    for (const server of response.response.serverlist) {
        let _server = server.split(":");
        Steam.servers.push({ "host": _server[0], "port": _server[1] });
    }
}
commented

thanks!