[SOLVED] API alternative to api.rtainc.co? / How to get Nightbot to pick one random response from a list?

I’ve been using customized “multiple choice” commands on my stream for a few months now. One example:

!nicecream $(urlfetch https://api.rtainc.co/twitch/random?format=[0]&choices=$(user) - you're super spiffy!,Are $(user)'s claws natural?,$(user) - love yourself! I love you!,$(user) looks nice today!,[An illustration of a hug.],$(user) - have a wonderful day!,Is this as sweet as $(user)?,$(user) is just great!,)

I used this topic to do it: Useful Custom APIs

I’ll be frank, I don’t understand a whole lot about how the process itself works; I just ripped the basic structure and used copypasta to get my own custom results. The problem now is that Nightbot gives errors whenever those commands are input - the site in that code is nearly always down.

My question is: is there another site I can use in place of the one in this code? Or is there another way to write a list of choices and have Nightbot pick one of them at random? This was a HUGE part of my stream and it just doesn’t feel the same without it! I would be so grateful for any advice!

At this point in time you can just use $(eval) for something like this.

!commands add !nicecream $(user) $(eval a=["you're super spiffy!", " I love you!", "etc.", "etc"];a[Math.floor(Math.random() * a.length)])

To edit: All options need to be surrounded by quotation marks(") with a comma (,) between them. All editing should take place in the dashboard.

Oh my gosh, thank you SO MUCH! It works PERFECTLY!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.