Hey @sawex!
Here’s how to make such command:
!addcom !sens $(eval s = ['SENS1', 'SENS2', 'SENS3', 'SENS4']; f = `Here are the various mouse sensitivity settings I use: ${s.join(', ')}`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); t[0] === 'offline' ? f : switch (t[1]) {case 'GAME1': s[0]; break; case 'GAME2': s[1]; break; case 'GAME3': s[2]; break; case 'GAME4': s[3]; break; default: f;})
All you have to do now is to replace the various SENS
and GAME
.
A cleaner way of doing this, which would also allow you to add as many game as you want without having to worry about the command’s character limit, would be to use a JSON with all your mouse sensitivities in there, you could even expand it and add more data/game if you’d like:
-
Create a JSON file and store it on Pastebin (create an account so you can edit it later):
{ "GAME1": { "mouse_sensitivity": "SENS1" }, "GAME2": { "mouse_sensitivity": "SENS2" }, "GAME3": { "mouse_sensitivity": "SENS3" }, "GAME4": { "mouse_sensitivity": "SENS4" } }
-
Then your command’s code would look like this:
$(eval p = $(urlfetch json https://pastebin.com/raw/XXXXXXXX); s = []; Object.values(p).forEach(k => s.push(k.mouse_sensitivity)); f = `Here are the various mouse sensitivity settings I use: ${s.join(', ')}`; t = '$(twitch $(channel) "{{status}}|{{game}}")'.split('|'); t[0] === 'offline' ? f : p[t[1]] ? p[t[1]].mouse_sensitivity : f;)
You need to replace
XXXXXXXX
with the paste ID.