gamedig / node-gamedig Goto Github PK
View Code? Open in Web Editor NEWQuery game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
Home Page: https://www.npmjs.com/package/gamedig
License: MIT License
Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
Home Page: https://www.npmjs.com/package/gamedig
License: MIT License
Hi, I'm trying to get unturned server data.
I tried all ports: 27015, 27016, 27016.
But I am getting the following error: UDP Watchdog Timeout.
Please help me to solve it.
Code :
function PlayersByIP(IP ) {
Gamedig.query({
type: 'unturned',
host: IP,
port: 27017
}).then((state) => {
var lol = state.players.map(obj => obj.name);
lol = lol.join();
var bots = state.bots.map(obj => obj.name);
bots = bots.join();
for(let endpoint of endpoints) {
endpoint.emit("send" , state.players.length + state.bots.length + " Players Online: " + lol + "," + bots);
}
}).catch((error) => {
console.log("Server is offline " + error);
});
How do I call the code :
message = message.toString();
console.log(message);
PlayersByIP(message);
Thanks!
Hi!
I set up everything and it's working fine except the players object what I get.
There are many player objects as many players are on the server but they are empty.
Is it something with the server itself?
Thanks.
Unreal Engine 4, port 27015
Getting this when running
return gamedig.query({
host: 'jb.clwo.eu',
type: 'csgo',
udpTimeout: 5000,
tcpTimeout: 5000
})
Any reason?
It would be great if there was support for StarMade. I use this package to query game servers and show that data online. If this can be supported, I would be very grateful. Here is the server info for testing: StarMade (96.19.173.45:4242).
Is there a way to get the time it took to query the data from a server? Basically I want to display the latency between the API server and game server - it would be a nice way to get the rough latency between a player and the game server if the player is located in the same country as the api server.
It would be great if results object have score of each team, i.e. Terrorists 13 - Counter-Terrorists 5.
I've tried querying both DayZ standalone and mod servers but I keep getting the UDP Watchdog Timeout error.
Here's the code:
var Gamedig = require('gamedig');
Gamedig.debug = true;
Gamedig.query({type: 'dayz', host: '199.189.85.77'}, function () { console.log(arguments) })
And the output:
$ node index.js
199.189.85.77:2302 UDP--> ffffffff54536f7572636520456e67696e6520517565727900
{ '0':
{ error: 'UDP Watchdog Timeout',
query:
{ host: '199.189.85.77',
address: '199.189.85.77',
port: 2302,
port_query: 2302,
type: 'dayz',
pretty: 'DayZ' } } }
I'm running two servers (games) at one machine. On two different ports - one 7777 another 7779 (and also 27015 and 27020) thenever i use --port to gamedig i ONLY get answer from the 7777 server - never from other - even if i know its running (and i even logged into it).
Servers Arma 3 not query. Produce this error from the website https://gamerlabs.net/query/:
"Could not connect to UDP socket"
Hello,
I'm not familiar with gamedig and I'm attempting to get the players and maxplayers for my unturned server(IP: GangsRP.playat.ch -- Server is down a lot).
I'm using a callback and when making an output format for the variables I want to list the max players vs players online(ex: 5/24 Players online). When attempting this an error is made stating that the variable player isn't defined, how would I grab the variable player? Also when I put it in the function arguments it doesn't run the function at all.
My Code -- discord.js:
var loading = message.guild.emojis.find('name','loading');
const m = await message.channel.send(`Checking Server Status ${loading}`);
Gamedig.query({
type: 'unturned',
host: 'GangsRP.playat.ch',
port: '27015',
note: message
},
async (e,state) => {
if(e){
var emoji = message.guild.emojis.find('name','xmark');
var embed = new Discord.RichEmbed()
.setColor("0xaa0000")
.setAuthor("Gang's RP Server Status", bot.user.avatarURL)
.setDescription(`**The server is: \`Offline\`** ${emoji}`)
m.edit({embed});
console.log(e);
} else {
var emoji = message.guild.emojis.find('name','check');
var embed = new Discord.RichEmbed()
.setColor("0x00aa00")
.setAuthor("Gang's RP Server Status", bot.user.avatarURL)
Player check -> .setDescription(`**The server is: \`Online\`** ${emoji}\n\n**Name:** Gang's RP - [ Roles, Kits, TPA, NO KOS, 8x Bases ]\n**IP Address:** GangsRP.playat.ch\n**Port:** 27015\n**Players:** ${players.length}\/${maxplayers}`)
m.edit({embed});
}
});
Hi there,
thanks for this awesome library! It's amazing. But I noticed one issue and I don't really know why after processing eg. 20-30 server it starts returning timeout errors. But let's start from the beginning. I'm creating another servers ranking page and I have to check every 1-2 minutes around 3k of Minecraft servers. It's simple script, basically I get list from DB, put tasks into queue and start processing with little concurrency, eg. 5. Initially I was thinking timeouts are caused by too high concurrency and real problems with my internet connection throughput. But nope.
Here's my query function (nothing special here):
function query_server(host, port, cb) {
Gamedig.query(
{
type: 'minecraftping',
host: host,
port_query: port,
udpTimeout: 2000,
tcpTimeout: 2000,
},
function(state) {
cb(state);
}
);
}
Please note the same problem is with query and ping protocols. The script starts fast and then slows down. After 100-200 processed items only one per 10 servers responds, others get TCP or UDP Watchdog timeout. Interesting is this 'slowing down'. Every next query is slower then previous (and finally they get timeout). Do you have any ideas WHY?
Of course I'm 100% sure all failed servers are online - checked with other tool and GameDig CLI - it was OK, but only fails when GameDig is working longer while.
It makes it impossible to see a diff of any changes you make...
Hey, I'm the lead sysadmin at /r/openttd, and I'm migrating our main control panel over from PHP to node. We used to use gameq to query our servers for state, but obviously I can't really use that anymore, so I guess I'm stuck with you guys!
As a result, is it possible to get some OpenTTD query support into gamedig? It'll really help me out, as our old method of query before I found gameq was based on a simple "can we open this socket? ok the server's up / down".
Many thanks!
Can you add this file and put information into it for contributing? I would like to add support for some games but not exactly sure how.
is there any way of multiple queries for example I need TS3 and Minecraft in same query ??
I wonder if you have any interest in implementing remote consoles for the protocols you support (possibly with community help). I find your library extremely useful but I would like to be able to execute commands too.
I think you're not maintaining this library anymore and you should mention that you're looking for maintainers, eventually pick one candidate and just allow the project to evolve and be updated please.
Right now it's a dead project which is a shame because a lot of hard preliminary work got done and rewriting if from scratch would just be kind of a waste of time.
Thank you for considering it
I cant get it to work with the game rust. Running it in the command line:
gamedig --type rust --host 142.4.216.124 --port 28065
I know this is a valid server. The error I'm getting is:
{"error":"UDP Watchdog Timeout","query":{"host":"142.4.216.124","address":"142.4.216.124","port":28065,"port_query":28066,"type":"rust","pretty":"Rust"}}
Hey man,
Was wondering if you could add the gamespy4 protocol to gamedig, as some games have updated to use it.
Specifically Just Cause 2 Multiplayer.
Regards
xCausxn
When I use this library in reaact-native project, I'm receiving this error:
error: bundling failed: "Unable to resolve module
dgram
fromE:\\Desktop\\New folder\\untitled\\node_modules\\gamedig\\lib\\index.js
: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches:watchman watch-del-all
.\n 2. Delete thenode_modules
folder:rm -rf node_modules && npm install
.\n 3. Reset packager cache:rm -fr $TMPDIR/react-*
ornpm start -- --reset-cache
."
Tried to install dgram
directly in the gamedig library folder, but it does not help.
Hello. Do you want add any proxy support?
server is online I'm connected to it
but gamedig says: server is offline
when i try to use global gamedig command
i get error: TCP Watchdog Timeout
ts3 server is on default port 9987 and its query port is 10011 what could be wrong ??
I found another project that basically same as this one. kurt-stolle/node-gamequery
I checked commit history, the first commit of this project was in July 2013. kurt-stolle's node-gamequery was in May 2015.
Two projects are extremely similar, basically same README, basically same code structure.
What do you think?
I don't consider this is a legit fork thing since that project's first ( or second should I say ) commit (e9ab10) says:
Merged original private project, removed Casual Bananas specific
references. Preparing to make project public.
Obvious he says that project is his own thing, was a private project.
Is this a copycat thing, or just you guys that lucky wrote same code?
/CC @kurt-stolle
Multiplayer for GTA 5 will be released soon. It will also be possible to get information about the servers there. Will you implement multiplayer support and how soon?
"gamedig": "0.2.24"
{ name: 'xxx',
map: 'workshop/265623436/de_dust2x2_classic',
password: false,
raw:
{ protocol: 17,
folder: 'csgo',
game: 'Counter-Strike: Global Offensive',
steamappid: 730,
numplayers: 10,
numbots: 0,
listentype: 'd',
environment: 'l',
secure: 1,
version: '1.34.9.9',
port: 27015,
tags: 'secure',
gameid: '730' },
maxplayers: 20,
players: [ {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ],
bots: [],
query:
{ host: 'xxx',
address: 'xxx',
port: 27015,
port_query: 27015,
type: 'csgo',
pretty: 'Counter-Strike: Global Offensive' } }
it's already done here: https://github.com/LiquidObsidian/fivereborn-query
you just need to implement it to your code
If I run gamedig --type protocol-valve --host 192.168.0.5 --port 25569
it returns a valid response of:
{"name":"Insurgency","map":"sinjar","password":false,"raw":{"protocol":17,"folder":"insurgency","game":"Insurgency","steamappid":0,"numplayers":0,"numbots":0,"listentype":"d","environment":"l","secure":1,"version":"2.0.6.2","port":25569,"steamid":"90097972027621383","tags":"firefight,theater:default,ver:2062,nwibanlist,empty,nospawnprotection,","gameid":"222880","rules":{"coop":"0","deathmatch":"1","decalfrequency":"10","ins_bot_change_difficulty":"1","ins_bot_difficulty":"1","ins_teamsize":"0","mp_allowNPCs":"1","mp_ambush_single_point_max":"10","mp_autocrosshair":"1","mp_coop_lobbysize":"6","mp_cp_capture_time":"30","mp_cp_deteriorate_time":"0","mp_cp_speedup_max":"4","mp_cp_speedup_rate":"0.26","mp_extract_point":"0","mp_fadetoblack":"0","mp_falldamage":"0","mp_flashlight":"0","mp_footsteps":"1","mp_forcerespawn":"1","mp_fraglimit":"0","mp_freezetime":"15.0","mp_friendlyfire":"1","mp_friendlyfire_explosives":"0","mp_joinwaittime":"20","mp_lobbytime":"10","mp_maxgames":"1","mp_maxrounds":"5","mp_minteamplayers":"1","mp_respawnwavetime_max":"0","mp_respawnwavetime_min":"0","mp_roundlives":"0","mp_roundtime":"600","mp_scrambleteams_auto":"0","mp_scrambleteams_auto_windifference":"3","mp_searchdestroy_single_cache_max":"12","mp_spawnprotectiontime_navspawn":"15","mp_spawnprotectontime":"10","mp_supply_rate_losing_team_high":"0","mp_supply_rate_losing_team_low":"0","mp_supply_rate_winning_team_high":"0","mp_supply_rate_winning_team_low":"0","mp_supply_token_base":"10","mp_supply_token_bot_base":"18","mp_supply_token_max":"20","mp_switchteams_each_game":"0","mp_switchteams_each_round":"0","mp_switchteams_reset_supply":"1","mp_teamlist":"hgrunt;scientist","mp_teamplay":"0","mp_teams_unbalance_limit":"1","mp_timelimit":"0","mp_timer_postgame":"0","mp_timer_postround":"15","mp_timer_pregame":"10","mp_timer_preround":"15","mp_timer_preround_first":"15","mp_timer_preround_switch":"30","mp_timer_voting":"25","mp_weaponstay":"0","mp_winlimit":"3","mp_winlimit_coop":"1","nextlevel":"","r_VehicleViewDampen":"1","spec_allow_bots":"0","sv_accelerate":"10","sv_airaccelerate":"10","sv_allchat":"1","sv_alltalk":"1","sv_alltalk_dead":"0","sv_alltalk_endgame":"1","sv_alltalk_intermission":"1","sv_bounce":"0","sv_cheats":"0","sv_contact":"","sv_deadtalk":"0","sv_deadtalk_team":"1","sv_deadvoice":"0","sv_footsteps":"1","sv_friction":"4","sv_gravity":"800","sv_hud_deathmessages":"0","sv_hud_deathmessages_spectator":"0","sv_hud_scoreboard_show_score":"0","sv_hud_scoreboard_show_score_dead":"1","sv_hud_targetindicator":"1","sv_map_voting":"1","sv_map_voting_shuffle":"1","sv_maxspeed":"1000.000000","sv_noclipaccelerate":"5","sv_noclipspeed":"5","sv_nwi_banlist":"1","sv_password":"0","sv_playlist":"","sv_rollangle":"0","sv_rollspeed":"200","sv_specaccelerate":"5","sv_specnoclip":"1","sv_specspeed":"3","sv_steamgroup":"","sv_stepsize":"18","sv_stopspeed":"75.000000","sv_stopspeed_prone":"45","sv_tags":"nospawnprotection","sv_voiceenable":"1","sv_wateraccelerate":"10","sv_waterfriction":"1","tv_enable":"0","tv_password":"0","tv_relaypassword":"0"}},"maxplayers":20,"players":[],"bots":[],"query":{"host":"192.168.0.5","address":"192.168.0.5","port":25569,"port_query":25569,"type":"protocol-valve"}}
However, if I run the code below (where this.serverConfig.gamehost
is 192.168.0.5
and this.serverConfig.gameport
is 25569
):
Gamedig.query({
type: "protocol-valve",
host: this.serverConfig.gamehost,
port: parseInt(this.serverConfig.gameport)
}, function (res) {
console.log(res);
});
It returns:
{ error: 'UDP Watchdog Timeout',
query:
{ host: '192.168.0.5',
address: '192.168.0.5',
port: 25569,
port_query: 25569,
type: 'protocol-valve' } }
Occasionally it will work correctly, but more often than not it will just fail without warning. This also happens with Minecraft servers, the only work around I've found was using minecraftping
not minecraft
.
When I use the snippet you posted in my Node.JS app, it always seems to return status offline for any servers I test. When I run the server through the command line executable though, it returns a status of true with all the data. Any ideas?
Hey, i getting this error using graph.cool . Looks like there is missing strict mode
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._compile (/data/sandbox/lib/module.js:127:21)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at WebtaskModule.require (/data/sandbox/lib/module.js:101:19)
at require (/data/sandbox/lib/module.js:136:21)
at Object.<anonymous> (/data/io/2a7475ab28884c25887bd992c4d7b708/webtask.js:1:79)
at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95:34)
Hi, i am trying to use gamedig after installing it globaly with "npm install gamedig -g".
when i hit gamedig --type arma3 --host 217.182.6.114 --port 2302 for example it throws:
{"error":"UDP Watchdog Timeout"}
it's my first time using it so forgive my ignorance.
Hello, i am getting this following error:
\node_modules\gamedig\protocols\core.js:103
if(options.host.match(/\d+.\d+.\d+.\d+/)) {
^
TypeError: undefined is not a function
at module.exports.Class.extend.start.async.series.offset (**node_modules\gamedig\protocols\core.js:103:21)
at *__node_modules\gamedig\node_modules\async\lib\async.js:607:21
at *__node_modules\gamedig\node_modules\async\lib\async.js:246:17
at async.eachSeries.iterate (node_modules\gamedig\node_modules\async\lib\async.js:146:13)
at async.eachSeries (_node_modules\gamedig\node_modules\async\lib\async.js:162:9)
at asyncMap (node_modules\gamedig\node_modules\async\lib\async.js:245:13)
at Object.doSeries as mapSeries
at Object.async.series (node_modules\gamedig\node_modules\async\lib\async.js:605:19)
at Class.module.exports.Class.extend.start (*node_modules\gamedig\protocols\core.js:99:9)
at **node_modules\gamedig\lib\index.js:72:10
at process._tickCallback (node.js:355:11)
I am not sure if this is a problem just for me.
It would be a nice feature to have, where you can specify the amount of retries gamedig should perform and the time between retries for if a server is offline.
For example, scan a server a max of 5 times with 1 second between scans.
This is something that could easily be implemented by users in their own projects but could also be a nice feature for the package itself.
Latest version has broken the CLI tool on OS X.
The file appears to be in dos format.
env: node\r: No such file or directory
hallo :)
i'm trying to use these code to query aa pg server. but i always get these error
{ _: [],
type: 'americasarmypg',
host: '37.59.203.232',
port: 8777 }
{"error":"UDP Watchdog Timeout","query":{"host":"37.59.203.232","address":"37.59.203.232","port":8777,"port_query":27020,"type":"americasarmypg","pretty":"America's Army: Proving Grounds"}}
i've tried :
can somebody help me with that ?
Thx in adv
Hi, I found no other way to contact you. I received a takedown notice from Github regarding the node-gamequery library I had forked. I had no idea it originated somewhere else.
Be that as it may, I'd like to take this opportunity to apologise. Also, I saw quite a few forks not mentioned in the takedown notice in the 'original' copy: https://github.com/kurt-stolle/node-gamequery/network/members.
I will remove the repo immediately.
Kind regards.
idk what is happening but when my bot is running on my vps (ubuntu 14.04.5) when it is querying a teamspeak3 server a teamspeak 3 client joins the server called "unknown" and leaves ... but when it is running on my computer (windows 10 pro) it doesn't do it and still queries the teamspeak 3 server the way it was suposed to.
it is anoying af is there a way to fix this or not ?
also when it queries the teamspeak 3 server name if there is this character "|" it saves it like this "\p" ... only happens when querying a teamspeak 3 server, i queried cs go and cs 1.6 and it didn't happened
Hey Man,
I would like to say i love this library, and that im am currently using it. I have integrated it into a web based query NodeJS server. I will be adding a credits page soon mentioning this project.
Can be found here: https://gamerlabs.net/query/
And again keep up the awesome work :)
xCausxn
While querying a quake 2 server I noticed maxplayers returned 0. The correct "maxplayers" value is under "maxclients" key which is under the raw values.
The server I was querying: 46.22.210.10:27910
After testing a rust server I noticed the numplayers is set, however the players information is not pushed into the array.
Example: https://api.gamerlabs.net/?type=rust&host=198.24.172.202&port=28015
Hi there, i've just update some older starbound instances. And it seams that Starbound changed something on the queries
Our server (does not query)
gamedig --type starbound --host das-uhrwerk.de --port 21025 (1.1.1)
{
"error":"UDP Watchdog Timeout",
"query":{
"host":"das-uhrwerk.de",
"address":"85.214.69.208",
"port":21025,
"port_query":21025,
"type":"starbound",
"pretty":"Starbound"}
}
Outdated Public Server (does query)
gamedig --type starbound --host 208.167.250.40 --port 21025 (Beta v. Glad Giraffe - Update 3)
{
"name":"A Starbound Server",
"map":"Unknown",
"password":false,
"raw":{
"protocol":7,
"folder":"starbound",
"game":"Starbound",
"steamappid":65534,
"numplayers":0,
"numbots":0,
"listentype":"D",
"environment":"W",
"secure":0,
"version":"Beta v. Glad Giraffe - Update 3",
"port":0,
"rules":{
"plugins":"none"
}
},
"maxplayers":4,
"players":[
],
"bots":[
],
"query":{
"host":"208.167.250.40",
"address":"208.167.250.40",
"port":21025,
"port_query":21025,
"type":"starbound",
"pretty":"Starbound"
}
}
Hello,
Wondering if it's somehow possible to fetch the steam id of the players so you can link to their community profiles and so on?
Please add support for dmp, found here: https://d-mp.org/
I will take a look at the /reference folder and see if i can create it for you before you get back to me.
Thanks
PS Awesome package
HI!
Is it possible to you add SA:MP support? To make it easier I found nice node.js module (https://github.com/Westie/server-inspector) which is able to get all information from SA:MP server.
It's known that you can't retrieve the player list when there are more than 100 players online, however you still can retrieve all other data, like mapname, servername, etc. With this plugin gamedig times out with error "timeout".
Try it yourself:
Type in the console gamedig --type samp --host 93.119.26.251 --port 7777
That's the IP + port of Romania Super Stunt (some random server I got from the internet list). Has 300 players at the time of writing, got the error message timeout. If you think this only happens with this IP + port, try an other one where the player count > 100.
Why doesn't this library return error as the first argument and result as second argument, as is the standard in node?
I'm asking because I tried promisifying the library and got an error because promisification libraries expect that first argument is an error, as they should.
Like the title says, the quake3 protocol doesn't have any numplayers integer. It retrieves the players but it doesn't put it in the array. Not sure if this is the way it should work, but all the protocols have a raw.numplayers, except this one ๐
Would it be possible to default to localhost if the host is omitted ?
I believe that xCausxn is the author of the website, but I have no way to notify does not work, so I put it here.
I've been using the web long for a project in .net
A few days ago does not work in Arma 3 and teamspeak.
Thank you very much for everything and my thanks to xCausxn and sonicsnes for its great library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.