Twitch Chat Steam Stat Commands
You can create commands that show your Steam stats and leaderboard position in your Twitch chat.
!addcom !stats Yes please!
Stats Endpoint
NightLight provides a public endpoint which you can use to retrieve a Dead by Daylight stat for a Steam user:
https://api.nightlight.gg/v1/steam-stats/{steam_id}/stats/{stat_name}(?format=plain|rank=include)
Example Response
When filled in with a 64-bit Steam ID and a stat name, you'll get a response like this:
https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/total_bloodpoints
{
"status": "success",
"error": null,
"data": {
"value": 348108708
}
}
Example Response with Rank
You can optionally add ?rank=include which will include your leaderboard rank in the response:
https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/total_bloodpoints?rank=include
{
"status": "success",
"error": null,
"data": {
"value": 348108708,
"rank": 17489
}
}
Plain Text Response
Alternatively, if you just want the value in plain text, you can specify ?format=plain like this:
https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/total_bloodpoints?format=plain
348,108,708
This option will format the value to be more human-readable. Commas are added to numbers, pips are formatted into grades, etc.
Supported Stats
You can retrieve any of the stats shown on the NightLight leaderboard.
To find the name of a stat, go to the leaderboard and edit, then sort by a column; the name will appear in the URL.
For example, if I show/sort by the stat "Ghost Face: Marked Survivors downed", this gets added to the URL: &sort_by=ghost_face_exposed_survivors_downed.
You can then copy the stat name and use it in your command, for example, in this case the link would be:
https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/ghost_face_exposed_survivors_downed
Nightbot Examples
These example commands use urlfetch to request the stats and then formats them into chat friendly messages.
You can substitute the steam ID for your own, change the stat, and customise the message however you like.
If you want to give a nod to NightLight in the commands, it is always appreciated!
Playtime
!addcom !playtime I've got $(urlfetch https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/playtime_all?format=plain) in Dead by Daylight on Steam!
I've got 2,162 hours in Dead by Daylight on Steam!
Total Bloodpoints
!addcom !bps $(eval const d=$(urlfetch json https://api.nightlight.gg/v1/steam-stats/76561198169190952/stats/total_bloodpoints?rank=include);
d.status==="success" ?
`I've earned ${d.data.value.toLocaleString()} bloodpoints which puts me at #${d.data.rank.toLocaleString()} on the NightLight leaderboard!` :
'There was an error fetching my bloodpoints')
I've earned 348,108,708 bloodpoints which puts me at #17,489 on the NightLight leaderboard!
Note
NightLight updates the steam stats profiles automatically, but due to the number of them and Steam's API rate limits, the automatic updates aren't overly frequent. To get the most up-to-date stats, you can trigger a refresh (if it hasn't refreshed too recently) by loading the profile in your browser.