Nightbot Command Issue

So like many others, I’m having a problem making a command. This is my first time doing a more complicated one like this, so I’m still an idiot when it comes down to it.

What I was trying to do was create a command that said, “(User) used (random Pokemon move) on (other user). It’s (‘super effective’ or ‘not very effective’)!”

I got the “effectiveness” part to work, but it’s the moves I’m having hard time with. I want to pull a random move from a list of about 150 moves I have in a PasteBin. Here’s the command I tried using:

!commands add !battle $(user) used $(eval a=$(urlfetch json,);a[Math.floor(Math.random()*(a.length-1))]) on $(touser)! It’s $(eval const responses = [‘super effective!’, ‘not very effective…’]; responses[Math.floor(Math.random() * responses.length)]:wink:

Any help would be greatly appreciated! Thanks!

Each line in needs to end with a comma.

So I went in and put a comma after every move, but it didn’t seem to do anything. Still gives me the, “Right-hand side of ‘instance-of’ is not an object” error in my chat.

Cleaned up a bit for you.

$(eval a=`$(urlfetch json`.split(`,`);`$(user) used ${a[Math.floor(Math.random()*(a.length-1))]} on $(touser)! It's ${Math.round(Math.random())==0?`super effective!`:`not very effective...`}`)
1 Like

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.