Thursday, 11 May 2017

Using SteamAPI to access the current users GameID

I'm currently looking to build a bot for my Twitch Channel, I have the bot with some standard commands for changing the game based on shorter commands.

I read and looked into it and apparently using the SteamAPI it's possible to figure out what game you're account is currently playing using:

http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=STEAM_API_KEY&steamids=STEAM_ID/

When I navigate to the above URL I get the following information:

{
    "response": {
        "players": [
            {
                "steamid": "76561198071832682",
                "communityvisibilitystate": 3,
                "profilestate": 1,
                "personaname": "LocKe",
                "lastlogoff": 1494465131,
                "commentpermission": 1,
                "profileurl": "http://steamcommunity.com/id/Locke33/",
                "avatar": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f5/f5939ea84ede9a4a92c81581d86356c11f85cc09.jpg",
                "avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f5/f5939ea84ede9a4a92c81581d86356c11f85cc09_medium.jpg",
                "avatarfull": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/f5/f5939ea84ede9a4a92c81581d86356c11f85cc09_full.jpg",
                "personastate": 1,
                "realname": "Conor",
                "primaryclanid": "103582791454321553",
                "timecreated": 1347915898,
                "personastateflags": 0,
                "gameextrainfo": "Counter-Strike: Global Offensive",
                "gameid": "730",
                "loccountrycode": "IE"
            }
        ]

    }
}

I can see "gameid": "730" which is Counter-Strike because I currently have it open, my only query I need is to return something like.

If gameID = 730 then which will then call my TwitchBot to change what game im playing, that way when I change from say CSGO to H1Z1 my bot will notice the change and automatically change my current game accordingly.

I'm currently using NodeJS and Notepad++ for this if that's any help.

Any help appreciated!



via CMagee33

No comments:

Post a Comment