Not an "instanceof"

Hi,
I’ve found this response code for nightbot to randomly generate a response when command is utilized, but it tells me “Right-hand side of ‘instanceof’ is not an object.” I’ve looked through several options with the same issue, but can’t find the error in this code:

$(user) $(eval lurk=’$(urlfetch json https://pastebin.com/raw/tUJGw65w)’.split(’#’);lurk[Math.floor(Math.random()*lurk.length)])

What I want it to say: USER (who typed the command) (randomized response).
Example: Chaxromi has faded into the mist.

Please help?

@chaxmix

The code should work, except maybe you’re using curly quotes instead of straight quotes. This should work:

$(user) $(eval a=`$(urlfetch json https://pastebin.com/raw/tUJGw65w)`.split(`#`).map(a=>a);a[Math.floor(Math.random()*a.length)])

You… are absolutely correct. TnT I spent so long trying to figure it out.

Thank you!! <3

I have been trying to use $(eval a=$(urlfetch json https://twitch.center/customapi/quote/list?token=Public_Token).match(/~\d+K~/g);a?(b=a.length,c=(+a.map(x=>x.slice(1,x.length-1)).join(,)+)):(b=0,c=``);`$(channel) has ${b} wins ${c})

and i keep getting Not an “instanceof”. I’ve tried changing the { to [ and its still didn’t work. This is all for a kill counter. Any idea what is wrong?

@wandering_vagabond

I assume you’ve already obtained a public and private token from the quote system… so delete copy and paste the following command response. Replace PUBLIC_TOKEN with your public token.

$(eval a=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.match(/~\d+K~\d+~/g);a?(a=a.filter(x=>x.split(`~`)[2]==a[a.length-1].split(`~`)[2]&&x.split(`~`)[1]!=`0K`),b=a.length,c=a.length?`(`+a.map(x=>x.split(`~`)[1]).join(`, `)+`)`:``):(b=0,c=``);`$(channel) has ${b} wins ${c}`)

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