Csgo stats command via csgo.tracker.gg

Asked Mar 23, 2021·4 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi,

I've checked across the forum and the internet first, cannot find a forum about this except one which doesn't work/is slightly different.

I have successfully implemented a Warzone command in nightbot following a very informative forum on this site titled [Warzone custom API command] and commented by [Emily] (can't post links)

I would like to create a CSGO command for a streamer I mod for, using the same tracker website used for the Warzone command but this time > csgo.tracker.gg

I would like the !csgo command to return something like:
Wins: $wins | Kills: $kills | Deaths: $deaths | K/D Ratio: $kd
and possibly the CSGO rank too? Although the tracker website doesn't state the rank, not sure if this is a option in the API?

The profile I am trying to make this for is ID 76561198383806520

If someone could guide me I would appreciate it very much. Even if this tracker website isn't the way to go, please let me know how I should proceed.

Thanks

4 replies

Hey @Cuddly Sheep!

Here's the link to the other post you mentioned.

The link to fetch the data of the user you're trying to look up is like this:

https://api.tracker.gg/api/v2/csgo/standard/profile/steam/STEAM_ID

So we'll use:

https://api.tracker.gg/api/v2/csgo/standard/profile/steam/76561198383806520

Now, for the command, it's actually similar to the original post, the only thing that changes slightly is the K/D ratio:

$(eval s=$(urlfetch json https://api.tracker.gg/api/v2/csgo/standard/profile/steam/76561198383806520).data.segments[0].stats; r=s.kd.value; k=s.kills.value; d=s.deaths.value; w=s.wins.value; `Wins: ${w} | Kills: ${k} | Deaths: ${d} | Kills/Deaths Ratio: ${Math.round(r*100)/100}`)

You are SO smart, seriously.

All works just as expected. Thank you so so much

Hi @Polar Cat,

Slightly off topic but I just want to let you know from your examples I was also able to implement a Valorant tracker off the same website, using Postman to assist.

Thank you v much

Awesome, glad to hear my examples and guide were enough to help you out!