NightDev Community Forums

Custom api for game specific commands

#1

is there a way to have a command only work whenever a certain game is set on your stream like if i have lol active the command works but if i have another game set the command does not work

#2

@parlinex

Cykotiq wrote an API that fetches a Twitch channel’s game.

$(urlfetch https://twitch.api.scorpstuff.com/game.php?user=$(channel))

You can use this along with some $(eval) logic to output a response only if your game is set, for example, to League of Legends.

$(eval `$(urlfetch https://twitch.api.scorpstuff.com/game.php?user=$(channel))`==`League of Legends`?`some response here...`:` `)
#3

Or, if you want to use what Nightbot has to offer rather than an API that does the same job, you can use: $(twitch $(channel) "{{game}}")