Eval combined with Random User

Hey there! I’ve seen some similar posts and responses but haven’t gotten my command to work with the suggestions so far. It may just have to do with how people format their responses on this site and i’m not understanding what to input, but this is what I have right now (with https changed to htps for posting here) -

!lick $(user) has licked $(urlfetch htps://2g.be/twitch/randomviewer.php?channel=$(channel))` $(eval const responses = [‘on the wenis’, ‘Ewwww’, ‘s big toe’, ‘behind the ear’, ‘WTF’, ‘last night’, ‘in the future???’, ‘s armpit’, ‘and gagged’, ‘like a dog’, ‘in the ear’]; responses[Math.floor(Math.random() * responses.length)]:wink:

Basically, the user would simply type “!lick” and nightbot would choose a random viewer as the subject and fill in the response from the selections. Thanks in advance.

obviously I didn’t mean for there to be an emoji. The text should end with a semicolon and right parenthesis NOT the winking emoji.

Hey @Eboy_Brian_UwU!

The random viewer API you’re using is no longer working due to Twitch breaking changes, use this one instead:

Next, beside a few quotes mistakes, your code is correct, here’s a fix:

$(eval const randomChatter = '$(urlfetch https://commands.garretcharp.com/twitch/chatter/$(channel))'; const responses = [' on the wenis', ' Ewwww', '\'s big toe', ' behind the ear', ' WTF', ' last night', ' in the future???', '\'s armpit', ' and gagged', ' like a dog', ' in the ear']; `$(user) has licked ${randomChatter}${responses[Math.floor(Math.random() * responses.length)]}`)

Here’s what I have now. The RandomChatter is working but I can’t get the Random Response to work.

!lick $(user) has licked $(urlfetch htps://commands.garretcharp.com/twitch/chatter/$(channel)?moderatorId=190525736) $(eval const responses = [‘on the wenis.’, ‘Ewwww.’, ‘s big toe.’, ‘behind the ear.’, ‘WTF!’, ‘last night…’, ‘in the future???’, ‘s armpit.’, ‘and gagged.’, ‘like a dog.’, ‘in the ear.’]; responses [Math.floor(Math.random() * responses.length)])

When I try the command the response I get looks similar to this

XXXXXX has licked YYYYYYY $(eval const responses = [‘on the wenis.’, ‘Ewwww.’, ‘s big toe.’, ‘behind the ear.’, ‘WTF!’, ‘last night…’, ‘in the future???’, ‘s armpit.’, ‘and gagged.’, ‘like a dog.’, ‘in the ear.’]; responses [Math.floor(Math.random() * responses.length)])

I don’t understand why it’s not computing the random responses.

it needs one more close parenthesis at the end… but i highly recommend u use the version @Emily gave u, as her version fixes the grammar for the possessive ones… aka, so it’ll say "user's big toe." instead of "user s big toe."
edit: oops, it’s not the close parenthesis… it’s the space between "responses" and the open bracket "[" right before "Math.floor"

1 Like

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