Skip to content

vngnc3/steam-playtime-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Steam Playtime API

Get user's playtime of a game on Steam with DecAPI Steam API without providing Steam app id.
Useful for custom chatbot commands and Twitch integration.


 

Dependencies

 

Getting Started

  1. Clone this repo.
  2. Install Node.js dependencies: npm install
  3. Create a .env file on the root directory.
  4. Set the streamer's Steam user ID and (optional) Steam API key in the .env file.
  5. Run the server: node server
  6. Fastify server will run on port 3000.

 

Usage

Once the server is started, the API can be called through /playtime/<GAME_NAME>.
Expected response:

    Gaben has been playing NEKOPARA Vol. 1 for 6.83 hours.

 

Recommended Usage

Using Nightbot and DecAPI, one can automate the API call and get the playtime of the currently streamed game on Twitch.

The Nightbot command will use two APIs respectively:

  1. ✨This API✨ <HOSTNAME>/playtime/<GAME_NAME>, and
  2. DecAPI https://decapi.me/twitch/game/<CHANNEL_NAME>.

Implementation in Nightbot can be done by nesting Nightbot variables:

$(urlfetch <HOSTNAME>/playtime/$(urlfetch https://decapi.me/twitch/game/<CHANNEL_NAME>))

 

Maintenance

Hit me up on Twitter @vngnc or Twitch izzyxizzy.

steam