Sourcequery
https://www.npmjs.com/package/sourcequery but working
Install / Use
/learn @MBR-0001/SourcequeryREADME
SourceQuery
https://www.npmjs.com/package/sourcequery but it doesn't suck
Valve docs: https://developer.valvesoftware.com/wiki/Server_queries
Usage
Install with npm:
npm install mbr-0001/sourcequery
Example usage:
const SourceQuery = require('sourcequery');
const query = new SourceQuery('127.0.0.1', 28015]);
//you can also provide timeout in ms [default 1000]
//and the option to automatically close the socket after the last request [default true]
query.getInfo().then(info => console.log('Server Info:', info));
query.getPlayers().then(players => console.log('Online Players:', players));
query.getRules().then(rules => console.log('Server Rules:', rules));
//if autoclose is false this method has to be called to close the socket
//query.close();
//to check if the server is "there" you can do the following
SourceQuery.preflightCheck('127.0.0.1', 28015).then(() => console.log("server is alive!")).catch(() => console.log("server is down!"));
Supported Games
AppID | Game | Notes | ------ | ---- | ----- | x | All HL1/HL2 games and mods | 10 | Counter-Strike 1.6 | 20 | Team Fortress Classic | 440 | Team Fortress 2 | 550 | Left 4 Dead | 550 | Left 4 Dead 2 | 730 | Counter-Strike: Global Offensive | 2400 | The Ship | 4000 | Garry's Mod | 17710 | Nuclear Dawn | 70000 | Dino D-Day | 33900 | Arma 2 | 107410 | Arma 3 | rules are broken thanks to devs | 211820 | Starbound | rules and players cannot be requested at the same time | 244850 | Space Engineers | 251570 | 7 Days to Die | 252490 | Rust | 282440 | Quake Live | 304930 | Unturned | 346110 | ARK: Survival Evolved | 393380 | Squad | 418460 | Rising Storm 2: Vietnam | 440900 | Conan Exiles | Server does not send rules 529180 | Dark and Light | 736220 | Post Scriptum | 834910 | ATLAS | 892970 | Valheim | Server does not send rules
Notes
- Compression is not supported, I don't know of any games that use it
