Enable/disable command when on a certain game

Asked Apr 23, 2024·5 replies·Last activity 2 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hello, I was wondering if theres a way to basically set up a way to turn off or change a command based on what game im playing on twitch. basically i have a ranked command and i was thinking can I set it up to have different outputs based on what game I'm on. Any help would be appreciated, thanks.

5 replies

yes, there is in fact a way to do that... it does rely on the game being listed correctly in twitch tho... meaning nightbot will only know what game u r playing by what twitch tells it, it cannot sense the actual game on your system...
u can blacklist/whitelist games using an array with the names in it, or a different response per game, may need to add more in a pastebin or something with the limited space

do u by any chance know of any examples of this being done before or u haven't seen any yourself?

Basically the only thing I want to do is set a command to output only when im playing Fortnite. If you have an idea on how to do this that would be great thanks.

i've not seen anybody else do such a thing, no, but i've done something similar... just need a bit of this...

js
$(eval `$(twitch $(channel) "{{game}}")`.toLowerCase()==`fortnite`?`YOUR_OUTPUT_HERE`:`NOT_FORTNITE`)

i included NOT_FORTNITE for your testing purposes, so u can see it doing the right thing rather than see no response and just hope it's working right, once tested replace that with a space between the `

Didn't find your answer? The community is on Discord.

Ask on Discord