Nightbot doesn’t read variables when called from a Pastebin, because it reads and replaces the variables once, so it just calls your Pastebin and that’s it. What you have to do is define $(user)
outside of the Pastebin, and then you can refer it inside and JavaScript will do the job. So your command would go like this:
$(eval u=`$(user)`; a=$(urlfetch json https://pastebin.com/raw/7FGZVsy3); a[Math.floor(Math.random()*a.length)];)
And then in the Pastebin replace every instance of $(user)
with ${u}
.