It’s possible using ehsankia’s quote list CustomAPI - read more about it here.
About the aspects of your Hot Potato game:
-
The commands I have set up below use the API to store the username of whoever is currently in possession of the hot potato. If the command user is in possession, the command user’s name is removed and another random user’s name is stored. If not, Nightbot will remind chat who actually is in possession.
-
As far as I know, Nightbot isn’t capable of keeping track of time elapsed since a command was used, so it’s neither possible to have a cooldown period nor have Nightbot automatically reset the game. This is why I’ve set up a command for mods to reset the game manually if there is a user who won’t continue the game.
-
I thought it would be better if there was one command !hotpotato that had multiple possible outputs rather than multiple commands each having their own output. This pastebin file is where I am storing those possible outputs. You can either use my paste or create your own.
If you create your own, make sure to follow the same formatting in my file and change the pastebin link used in the command response (the link is found in the middle of the command response for
_hp
). The file starts and ends with square brackets. Each output is bounded by backticks `` and separated by commas.p1
represents the ‘sender’ of the hot potato andp2
represents the ‘receiver’, which the command will replace with the corresponding usernames.
Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token=
and before &data=$(querystring)
Copy them down and keep them somewhere safe!
I’ve set up 3 commands: !hotpotato and _hp which work in tandem to check whether the user is currently in possession of the ‘hot potato’ and output an appropriate response, and !reset which resets the hot potato game (mod-only). Copy and paste them into chat. Replace PUBLIC_TOKEN
with your public token and PRIVATE_TOKEN
with your private token:
!addcom -cd=5 !hotpotato -a=_hp $(eval u=`$(user)`.toLowerCase();a=JSON.parse(`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`).chatters;b=a.moderators.concat(a.staff,a.admins,a.global_mods,a.viewers).filter(c=>![u,$(urlfetch json https://pastebin.com/raw/mtfpjMTp)].some(d=>c==d));e=`$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=0&no_id=1)`;e==u||e==`There are no quotes added`?`PRIVATE_TOKEN `+b[Math.floor(Math.random()*b.length)]:e)
!addcom -cd=5 _hp $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=$(1)&clear=1)`;b=`$(urlfetch https://twitch.center/customapi/addquote?token=$(1)&data=$(2))`;c=$(urlfetch json https://pastebin.com/raw/KqzVrruf);`$(query)`.includes(`PRIVATE_TOKEN`)?c[Math.floor(Math.random()*c.length)].replace(/p1/gi,`$(user)`).replace(/p2/gi,`$(2)`):`$(1) is currently in possession!`)
!addcom -ul=mod !reset $(eval a=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`;`$(user) has reset the hot potato game!`)