Nightbot 8ball Command w/Pastebin?

To anyone who sees this, hey. So I’m having trouble executing the commands for 8ball with Nightbot. The catch-22 is that initially, I had it set up and ready to go yesterday. However, today I found out about pastebin and how I can make even more variety of different responses. So I tried it with 8ball, but it seems that I still run into issues with the command. The goal for me is trying to figure out if a pastbin URL can be registered with 8ball.

Here’s how I had it set up:
$(eval a = "$(urlfetch json https://pastebin.com/raw/pVKK19dN)".split(";");a[Math.floor(Math.random()* a.length)])

Is there any solution to fix this?

yes, just need to change .split(";") to .split(",")

… or u could change the paste and add {"a": before the [ and } after the ] and then in the command remove the .split(";") and the quotes around the urlfetch… and change a[Math.floor(Math.random()*a.length)] to a.a[Math.floor(Math.random()*a.a.length)]

Hey. So for the 1st part, I’ve gotten an invalid or unexpected token [:1:5]. That was from swapping out the ";" to "," besides split. Is it an error on my pastebin? Maybe?

Could you also elaborate on the 2nd part? Which paste am I specifically changing?

oh, i dinna see that u had quotation marks in the paste… yeah, your easiest fix is probly gonna be the second option… um, in the pastebin paste the first thing u have is an open square bracket “[” and the last thing is a close square bracket “]” if u add those other things like i said, so those look like {"a":[ and ]} instead of just the square brackets and then make the command look like this…

$(eval a=$(urlfetch json https://pastebin.com/raw/pVKK19dN);a.a[Math.floor(Math.random()*a.a.length)])

it should work

Problem solved. Thank you! It works!
Sorry. I’m a newbie still learning about how to code things, and I really appreciate this.

1 Like

lol, i’m still learning too, helping people with nightbot commands is part of how i practice and remember what i’ve learned… plus i like helping people ^^

1 Like

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