Nightbot 8ball Command w/Pastebin?

Asked Feb 9, 2024·5 replies·Last activity 2 years 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.

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?

5 replies

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 [<context>: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...

js
$(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.

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 ^^

Didn't find your answer? The community is on Discord.

Ask on Discord