Adding !hours from main and alt account into one command

Hi, Been trying figure out a way to make a command that adds the in-game hours from 2 accounts into one !hours command. Using this ‘’!hours command to return steam game hours’’ to get the hours in chat, but now the streamer has gotten an alt account. And he is gonna be jumping between both as he plays! So I was wondering if it is possible somehow to add the hours together, ao it updates automatically? if not what would be a good way to try out?

You can use this command code (remember to replace APP_ID_HERE (both times it appears), STEAM_ID_1_HERE, and STEAM_ID_2_HERE):

$(eval f=null;h=["$(querystring $(urlfetch json","$(querystring $(urlfetch json"].reduce((a,c)=>a+(d=decodeURIComponent(c),isNaN(n=parseFloat(d.split(" ")[0]))?(f=d,0):n),0);f==null?`${h.toFixed(2)} hours`:`Failed to parse response: ${f}`)

If the Steam accounts are not public, then follow Decicus’s instructions for adding the Steam API key of each account’s owner.

Thanks! That works fine, but it responds with ‘‘7160.950000000001 hours’’, is there a way to shorten it down a bit? More like ‘‘7160.95 hours’’ ?

Yes. Add .toFixed(2) when displaying the number of hours. I updated my post to do this.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.