Current game and description command?

Recently, I’ve been trying to put together a !currentgame command that will pull the name of the game and its description on Twitch to cut back on all the time being wasted by people waddling into the chat and asking “What is this game, what’s it about?”

I’m really struggling with trying to hook into the description. I’ve done a ton of Googling and I’m shocked at the lack of results. Either I’m the only crotchety person out there who is sick of repeating themselves (which is hard to believe), or it’s much harder to impossible to hook into Twitch and yoink the game category description.

Has anyone ever tried this?

Hey @Vanderbeam!

You can easily do this by using the power of JSON!

First go to Pastebin, create an account in order to be able to add more games in the future.
Next create your JSON file, here’s how to do it:

{
    "game name": "description",
    "second game": "description",
    "third game": "description",
    "nth game": "description"
}

Click here for more explanation on the JSON format.
Note: if you need to add a ", a /, or a \ in your text, you’ll need to precede it by a back slash \, so for example \"text\" will give you "text", or https:\/\/nightbot.tv will give you https://nightbot.tv, I’m specifying it because it’s a common mistake.

So for example:

{
    "Disco Elysium": "Disco Elysium is a groundbreaking role playing game. You’re a detective with a unique skill system at your disposal and a whole city to carve your path across. Interrogate unforgettable characters, crack murders or take bribes. Become a hero or an absolute disaster of a human being.",
    "NieR: Automata": "NieR: Automata tells the story of androids 2B, 9S and A2 and their battle to reclaim the machine-driven dystopia overrun by powerful machines."
}

It’s important for the game names to match how Twitch refers to them, otherwise it won’t work.
Save the paste with the expiration date set to Never and the exposure set to Unlisted.
When you’ll need to add more games you’ll just have to come back to that file and edit it.

Finally take note of the paste ID and replace it in the following command:

 $(eval p=$(urlfetch json https://pastebin.com/raw/XXXXXXXX); g=`$(twitch $(channel) "{{game}}")`; d=p[`${g}`]; d?d:`${g}'s description not found.`)

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