!guess command for nightbot

Asked Sep 24, 2025·1 reply·Last activity 11 months 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.

Hi! So I am trying to make a !guess command and !guesswinner command for my channel. I play a lot of phasmophobia and I want to make it interactive where they can guess which ghost it is and then have it register they won. I am super new to java so I really don’t know too much. But it isnt registering the correct guesses and just keeps saying nobody guessed it right, even when they did. These are my lines of code for the commands

!startguess: $(eval a="$(urlfetch https://twitch.center/customapi/delquote?token=yourtoken&clear=1)"; "A new guessing game has started! Type !guess \[your guess\] to play.")

!guess: $(eval $(urlfetch https://twitch.center/customapi/addquote?token=yourtoken&silent=1&data=$(user)|$(querystring)|)) $(user): guess registered.

!guesswinners: $(eval q=decodeURIComponent(\$(querystring)\); c=\$(urlfetch json https://twitch.center/customapi/quote/list?token=yourtoken&data&no_id=1&clear=1)\.split("|"); w=\[\]; for(i=0;i<c.length-1;i+=2){if(c\[i+1\].trim().toLowerCase() === q){w.push(c\[i\].trim())}} r=w.length>0?\The winners who entered "${q}" are: ${w.join(", ")}. Congratulations!\:\No winners were found who entered "${q}".\; r)

!resetguess: $(urlfetch https://twitch.center/customapi/delquote?token=yourtoken&clear=1) Guesses have been reset.

If you guys have any suggestions please let me know. Again I am new to java and a new streamer and I just want to make my stream as interactive as possible so my viewers have the best viewing experience.

1 reply

it doesnt directly answer your question, but have you considered using twitch’s in-built predictions instead?