joshuaferrara / node-csgo Goto Github PK
View Code? Open in Web Editor NEWA node-steam plugin for Counter-Strike: Global Offensive.
License: MIT License
A node-steam plugin for Counter-Strike: Global Offensive.
License: MIT License
Hello !
I can't manage to make requestRecentGames working. I made this code. Is it wrong ? Or maybe Valve disable it (like the other one) ?
Thanks.
(Code)
async function getMatchesFor(steamid) {
console.log("* sending request");
var res_cs = csgo.requestRecentGames(steamid);
console.log("* request method returned "+res_cs);
while(received_matchs_infos == null) {
console.log("* waiting because no response");
await sleep(1000);
}
console.log("* got return value");
val = received_matchs_infos;
received_matchs_infos = null;
return val;
}
// I use this function after receiving loggedOn event (and after connectedToGC event)
The sharecode decover is not working for me:
`
var Steam = require('steam');
var csgo = require('csgo')var steamClient = new Steam.SteamClient();
var steamUser = new Steam.SteamUser(steamClient);
steamClient.connect();
steamClient.on('connected', function() {
steamUser.logOn({
account_name: 'redacted',
password: 'redacted'
});
});steamClient.on('logOnResponse', function() {
steamGC = new Steam.SteamGameCoordinator(steamClient, 730);
CSGO = new csgo.CSGOClient(steamUser, steamGC, false);console.log(CSGO.SharecodeDecoder("CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD").decode());
});
`
Since the start of using the 'package', I've been trying to recieve player profile information; however, all requests no matter what valid accoundID
provided returns null
for the majority of the fields:
{
"request_id": null,
"account_profiles": [
{
"account_id": 396346719,
"ongoingmatch": null,
"global_stats": null,
"penalty_seconds": null,
"penalty_reason": null,
"vac_banned": null,
"ranking": null,
"commendation": {
"cmd_friendly": 19,
"cmd_teaching": 16,
"cmd_leader": 18
},
"medals": {
"medal_team": null,
"medal_combat": null,
"medal_weapon": null,
"medal_global": null,
"medal_arms": null,
"display_items_defidx": [
4674,
970,
1367
],
"featured_display_item_defidx": 4674
},
"my_current_event": null,
"my_current_event_teams": [],
"my_current_team": null,
"my_current_event_stages": [],
"survey_vote": null,
"activity": null,
"player_level": 14,
"player_cur_xp": 327681231,
"player_xp_bonus_flags": null
}
]
}
The logs return:
13 Dec 23:37:01 - Launching CS:GO
13 Dec 23:37:03 - Sending ClientHello
13 Dec 23:37:03 - CS:GO fromGC: 4004
13 Dec 23:37:03 - Received client welcome.
13 Dec 23:37:03 - Sending player profile request
13 Dec 23:37:04 - CS:GO fromGC: 9173
13 Dec 23:37:04 - CS:GO fromGC: 9128
13 Dec 23:37:04 - Received player profile
Can confirm CS GO is running, as it established a successful connection and:
In addition, I've had the client crash to a random error:
/root/**********/node_modules/csgo/helpers/VDF.js:28
var name = buffer.readCString();
^
TypeError: buffer.readCString is not a function
at Object.exports.decode (/root/**********/node_modules/csgo/helpers/VDF.js:28:31)
at CSGOClient.handlers.<computed> (/root/**********/node_modules/csgo/handlers/rich_presence.js:44:20)
at SteamClient.<anonymous> (/root/**********/node_modules/csgo/index.js:50:30)
at SteamClient.emit (events.js:326:22)
at SteamClient._netMsgReceived (/root/**********/node_modules/steam/lib/steam_client.js:175:10)
at SteamClient.handlers.<computed> (/root/**********/node_modules/steam/lib/steam_client.js:262:10)
at SteamClient._netMsgReceived (/root/**********/node_modules/steam/lib/steam_client.js:160:26)
at Connection.emit (events.js:314:20)
at Connection._readPacket (/root/**********/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:314:20)
at emitReadable_ (_stream_readable.js:557:12)
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Can provide more information if needed!
SInce the gitter chat appears to be dead, I decided to open an issue on matter.
The node steam module successfully connects and logs in, however, after CSGOClient.launch(), it is stuck in a loop constantly trying to send ClientHello, and doesn't move from there.
this is my code:
csgo.launch();
csgo.playerProfileRequest(AccountID);
csgo.on('playerProfile',function(profiles) {
console.log("playerProfile received");
});
console never log the "playerProfile received".
Hello
Im on event "friend" from node-steam call:
CSGO.playerProfileRequest(CSGO.ToAccountID(sid));
CSGO.on("playerProfile", function(profile) {
//get player profil info
}
I have a problem when check first friend is ok, but when I add second friend "playerProfile" is calling two times for first and second friend.
How can I fix it?
Or how its impemented on twitch?
This is probably not an issue with node-csgo itself, but I figured this would still be the best place to post to get an answer.
The matchList
response from requestRecentGames
never seems to populate game_type
, game_mapgroup
and game_map
. Is that just how it is?
It seems a bit strange considering the map names are displayed in game on the "Your Matches" page.
Thanks,
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I'm having a problem with turning the json response back into protos.
This worked earlier with the bundled protos in v1.5.7.
What im trying to do is to be able to create the dem.info files so that i keep the same format that downloading manually from csgo does.
So what im doing is to take the matchList response, taking out the match in that list trying to create a proto object with it.
if you check out this repo i've created a demo that showcases the error, https://github.com/ajohnsen/node-csgo-proto-encode-error
if you download that and run 'STEAM_USERNAME= STEAM_PASSWORD= npm start' it will run the demo and request a game from a sharecode. And then when the matchList response comes in it tries to create the dem.info file, but fails when trying to make the proto file.
If you take a look at works.js (run with 'npm works') this will read match.dem.info and decode it into a json object, before it turns it back into a protobuf object and writes it to a new file (new.dem.info).
You can check that these files are the same with md5
The only difference i see in the json is that the one that is not working is missing the tv_control and flags attribute from roundstatall[].reservation, and that the last roundstatall[].map is null on the working one and has the download link on the non working one.
Edit: even if i add the missing flags and make the json completely different (using JSON.strigify and comparing with jsondiff.com) i still only get the problem with one of them. Even if i do it in the same file.
The error message im getting is:
Error: Illegal value for [object Object] of type uint64: object (not convertible to Long)
at line 1769 in Protobuf.js
Edit 2: From my digging around in protobuf.js it looks like its trying to read the Long value for matchId by parsing the entire json object as the long value and failing.
Unable to connect SteamClient to steam servers
Debug:
connecting to 162.254.196.41:27017
socket timed out
socket closed
connecting to 162.254.196.40:27020
socket timed out
socket closed
Hi,
can i use it without game in profile?
i have just create new steam acc, connected well, but can`t recieve csgo infos
According to the console command "version", that value is the Protocol version, which (at least at the current update) is the same as the EXE version but without points.
So maybe it's required to make sure that the client is on the latest version?
Here's what the current "version" looks like:
Protocol version 13504
Exe version 1.35.0.4 (csgo)
Exe build: 17:12:46 Sep 30 2015 (6171) (730)
This is not really an issue (apart from the fact that the example is now outdated (13503 instead of 13504), just some info on the number.
Sometimes, i don't know why it returns this
{ request_id: null,
account_profiles:
[ { account_id: 152304352,
ongoingmatch: null,
global_stats: null,
penalty_seconds: null,
penalty_reason: null,
vac_banned: null,
ranking: null,
commendation: [Object],
medals: [Object],
my_current_event: null,
my_current_event_teams: [],
my_current_team: null,
my_current_event_stages: [],
survey_vote: null,
activity: null,
player_level: 20,
player_cur_xp: 327680966,
player_xp_bonus_flags: null } ] }
Any idea why i can't get the rank ?
Ty
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I am using this snippet for testing:
steamFriends.setPersonaState(steam.EPersonaState.Busy);
const counterstrike = new csgo.CSGOClient(steamUser, steamCoordinator, false);
counterstrike.launch();
const decode = new csgo.SharecodeDecoder(sharecode);
counterstrike.on('ready', () => {
counterstrike.requestGame(decode.matchId, decode.outcomeId, decode.tokenId);
});
counterstrike.on('matchList', (matchResponse) => {
console.log(JSON.stringify(matchResponse));
});
which always returns
{
"msgrequestid": 0000,
"accountid": 000000000,
"servertime": 0000000000,
"matches": [],
"streams": [],
"tournamentinfo": null
}
Am I doing something wrong? The matches are always very recent (A few hours ago) - so they should definitely be returned? Or am I missing something?
/del
solved
What's the correctly way to make a Non Steam Game visible?
I've tried:
bot.gamesPlayed(["test name", 730]);
And
bot.setGameName(["teste"]);
Still shows CS:GO as currently game running.
Doesn't get any matchList
anymore so my requests timeouts.
I've tried both on csgostats.gg and csgorunner.com. None of them find the live games. Tried on multiple playing players on MM.
https://csgostats.gg/player/76561198292738220#/live
https://www.csgorunner.com/76561198405310863
There is a $100 open bounty on this issue. Add to the bounty at Bountysource.
how can i install it correctly?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Hi ! Don't know if the project is supposed to be up to date but it seems the launch of CS GO is broken :
.CMsgClientGamesPlayed.GamePlayed#games_played is not a Field
I fixed the issue changing
this._user.gamesPlayed({
games_played: [{game_id: '730'}]
});
to
this._user.gamesPlayed([{game_id: '730'}]);
in index.js
Hey guys,
Basicaly I want to get infos from the matches that my own cs:go servers will do... Infos like: kills, deaths, assists, etc...
I heard about that Valve let we do a request each 60 seconds to pull those infos to my website?
Thank soo much guys!
Hello. Me and my friend are trying to do a simple app that would take all the steam64ids from mysql and then use the id in playerProfileRequest.
`var j = schedule.scheduleJob('*/5 * * * * *', function(){
var array = [];
con.query("SELECT * FROM counterStrikeGlobalOffensive", function (err, rows) {
for (var i = 0; i < rows.length; i++) {
console.log(rows[i].steam64ID);
CSGOCli.playerProfileRequest(CSGOCli.ToAccountID(rows[i].steam64ID));
CSGOCli.on("playerProfile", function(profile) {
console.log(profile.account_profiles[0].ranking.rank_id);
return;
});
}
});
return;
});`
This is where my problem begins. When I do console.log(rows[i].steam64ID, it returns all of the ids that are in the mysql. Then I put the id in playerProfileRequest and then when I do console.log(profile), it keeps repeating the same data for each steamid.
I have basically same issue as discussed in recently closed #80
When I try to launch node-csgo it gets stuck at Sending ClientHello, never firing ready
event.
My code: https://pastebin.com/H9fCSubE
It's more or less just the example script.
Output:
Username: ******************
Password: ********************
31 Jan 23:59:37 - Logged in!
31 Jan 23:59:37 - Logged on.
31 Jan 23:59:37 - Launching CS:GO
31 Jan 23:59:37 - Received servers.
31 Jan 23:59:40 - Sending ClientHello
31 Jan 23:59:42 - Sending ClientHello
31 Jan 23:59:45 - Sending ClientHello
31 Jan 23:59:47 - Sending ClientHello
31 Jan 23:59:50 - Sending ClientHello
31 Jan 23:59:52 - Sending ClientHello
31 Jan 23:59:55 - Sending ClientHello
31 Jan 23:59:57 - Sending ClientHello
1 Feb 00:00:00 - Sending ClientHello
1 Feb 00:00:02 - Sending ClientHello
1 Feb 00:00:05 - Sending ClientHello
1 Feb 00:00:07 - Sending ClientHello
However node-dota2 works fine.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I'm not sure why GCConnectionStatus is undefined, but it doesn't appearing in CSGO scope.
/home/csgo/node_modules/csgo/index.js:121
case CSGO.GCConnectionStatus.GCConnectionStatus_HAVE_SESSION:
^
TypeError: Cannot read property 'GCConnectionStatus_HAVE_SESSION' of undefined
at CSGOClient.gcClientConnectionStatus (/home/csgo/node_modules/csgo/index.js:121:33)
at SteamClient.fromGC (/home/csgo/node_modules/csgo/index.js:32:30)
at SteamClient.emit (events.js:118:17)
at SteamClient.handlers.(anonymous function) (/home/csgo/node_modules/steam/lib/handlers/game_coordinator.js:59:13)
at SteamClient._netMsgReceived (/home/csgo/node_modules/steam/lib/steam_client.js:106:26)
at SteamClient.handlers.(anonymous function) (/home/csgo/node_modules/steam/lib/steam_client.js:192:10)
at SteamClient._netMsgReceived (/home/csgo/node_modules/steam/lib/steam_client.js:106:26)
at Connection.emit (events.js:107:17)
at Connection._readPacket (/home/csgo/node_modules/steam/lib/connection.js:50:8)
Through requestCurrentLiveGames I only can gather match_id, I would like to wait for them to wait and download its replay. Is there a way to get outcomeId and tokenId from those matches? Its easy to wait for them to end, but I don't know how to get the token or the outcome
Hello
I have a problem with event friend and getting player.
My friend event:
steamFriends.on('friend', function(userId, relationship) {
if (relationship == 2 && !_.contains(secrets.blacklist, userId)) {
steamFriends.addFriend(userId);
setTimeout(function() {
steamFriends.sendMessage(userId, 'Hello');
setTimeout(function() {
CSGO.playerProfileRequest(CSGO.ToAccountID(userId));
CSGO.on("playerProfile", function(profile) {
steamFriends.sendMessage(userId, 'test');
});
}, 2000);
}, 3000);
}
});
and when I first time add bot he send me: Hello and test, but when I remove him and add again he send me Hello, test, test.
If I again remove and add him he send me Hello, test, test, test
Why? How can I get fix it?
For now, use node-steam version 0.6.8 which is the most recent compatible update and is the last update before the 1.0.0 update.
npm install [email protected]
do you have any idea how to get sticker image with sticker id ?
Hi, would it be possible to find the prime status of a given user?
steam-resources
has a prepare
script in their package.json
that uses svn
to clone stuff on installation.
When I try to do a fresh installation without node_modules
it fails to install. Not every server has svn
installed on their machines...
Hi , so I want to get started with this repo to make a website for csgo that pulls certain information from the game/player.
I'm having a hard time getting started. While the documentation on the readme is superb, there's isn't enough for someone new to get started.
I saw there was an example.js, but none of it is commented, and its using a lot of stuff not mentioned in the readme. Even when I run the example.js, after setting my username and password, it asks for an auth code, and no where in there does it specify how to get an auth code.
Basically, if I'm a web developer and all I want to do is pull off some user data what's the best way to do that, Can someone provide me with a full code snippet on something that works, so I can get started? I couldn't find any tutorials online for this specific repo.
Please don't get mad if this seems like a dumb post, I'm just trying to get started :)
Hey guys, I'm pretty newbie to node but I'm having this problem... where text fields are just showing null.
https://gist.github.com/riser-/96c161d2bfff1d011eeb
Code and response, any idea why?
Thanks!
can i join my own server with this code?
can`t get ranking info with playerProfileRequest()
recieve all info except ranking
hi, when I use CSGO.requestGame()
, providing all the parameter that I get from SharecodeDecoder
, in the matchList
response I can find the match with all the information for every round but I cannot get the watchablematchinfo
like game_type
, game_mapgroup
, game_map
because they are assigned to null
.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
I think I've figured out how to extract the matchId and the reservationId of the last round which I assume to be the outcomeId, but I have no clue how to get the token. I dumped the entire match into a file and tried to search for token or even the token I manually extracted from one sharecode but neither found anything.
I also failed to find the sharecode encoder if such a thing exists.
22 Feb 17:05:52 - GC Connection went missing, exiting
After Loggued i get this error.
When I do node example.js, I get the following error:
error, { eresult: 5,
eresult_extended: 5,
client_supplied_steamid: 'xxxxxxxxxxx',
count_loginfailures_to_migrate: 0,
count_disconnects_to_migrate: 0 }
The 'unready'
event on CSGO
only triggers on unexpected interruptions to the GC connection. Currently, there is no specific event that triggers on CSGO.exit()
.
The README may lead one to believe that it is recommended practice to remove any event listeners on the unready
event -- yet, that doesn't account for intentional exits. An exited
event would be ideal here.
Hey man this looks like a sweet project. I really want some api that will let me automatically download my recent demos from matchmaking. Have you thought about adding the demo list to this?
var Steam = require('steam'),
steamClient = new Steam.SteamClient(),
steamUser = new Steam.SteamUser(steamClient),
steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
csgo = require('csgo'),
CSGO = new csgo.CSGOClient(steamUser, steamGC, false);
var decoded = new csgo.SharecodeDecoder("CSGO-7UvAK-FD3Ac-8DeTA-74ZUK-9Sm6J").decode();
console.log(decoded);
var requestinfo = CSGO.requestGame(decoded.matchId, decoded.outcomeId, decoded.tokenId);
console.log(requestinfo);
I'm currently unable to request profiles for multiple players as the 'playerProfile' event only gets fired once.
This happens both when quickly requesting player profiles (in a loop) and waiting to request the next one until the previous one has been received.
EDIT: It suddenly worked.
i enable the debug mode, and it always return Sending ClientHello, the ready event never trigger.
i have connected to the steamClient and logon a steamuser.
Hi, first off, full code:
http://pastebin.com/Jn1xuJuQ
So I wait for any friend to start CS:GO. If it happened, I try to request profile. This is the result: https://gyazo.com/026fe3ca605964d1cb93c753ea49a06a
So it fails with friendObj.friendid
But the stupid thing is... with steamClient.steamID it works.
I already discussed this with a guy in gitter but he couldnt help me :/ We tried much...
var Steam = require('steam'),
steamClient = new Steam.SteamClient(),
steamUser = new Steam.SteamUser(steamClient),
steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
csgo = require('csgo'),
CSGO = new csgo.CSGOClient(steamUser, steamGC, true);
module.exports.login = async (user, password) => {
CSGO.launch();
}
29 Apr 22:18:03 - Launching CS:GO (node:4528) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at SteamClient._send (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cyberpunk 2077\Desktop\VertBob\node_modules\steam\lib\steam_client.js:117:20) at SteamClient.send (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cyberpunk 2077\Desktop\VertBob\node_modules\steam\lib\steam_client.js:126:8)
Tried node V12 and V14
https://github.com/joshuaferrara/node-csgo/blob/master/handlers/match.js#L39
I'm able to get the event, matchList
, to trigger but not that callback. I rather use that callback because it fits my needs better. Can this be fixed?
Am I only able to pull my own recent matches?
Do you think there's a way when we can use
message CMsgGCCStrike15_v2_MatchListRequestFullGameInfo {
optional uint64 matchid = 1;
optional uint64 outcomeid = 2;
optional uint32 token = 3;
}
?
I'm trying to make it work, but I have no matches in reponse. I think outcomeid is id of last round, but I have no clue what token value should be.
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.