So I am trying to make a command that chooses a random pickup line and I can't get it to work. This is what I have and I don't know why but it always comes up as an "Unexpected Identifier"
Hey $(touser), $(eval const responses = ['Are you an angel? Cause you\’re perfect.', 'If you were an angel, then I'd be a devil. I just want to corrupt you',' If you\’re an angel imma start going to church so I can go to heaven and see you', 'Are you Cupid cause the moment I saw you I fell in love.']; responses[Math.floor(Math.random() * responses.length)]; )
Random outcomes
8 replies
Use
"
and
\
if you are using
'
in a middle of array.
Hey $(touser), $(eval const responses = ["Are you an angel? Cause you are perfect.", "If you were an angel, then I would be a devil. I just want to corrupt you", "If you are an angel imma start going to church so I can go to heaven and see you", "Are you Cupid cause the moment I saw you I fell in love."]; responses[Math.floor(Math.random() * responses.length)]; )
Hey @Dusty Kangaroo!
By replacing your single quote marks with backticks `` ``` it should fix it:
$(eval r=[`are you an angel? Cause you're perfect.`, `if you were an angel, then I'd be a devil. I just want to corrupt you.`, `if you're an angel imma start going to church so I can go to heaven and see you.`, `are you Cupid cause the moment I saw you I fell in love.`]; `Hey $(touser), ${r[Math.floor(Math.random()*r.length)]}`)
I fixed it and updated my previous reply.
Have you copied the updated version of my first reply? Because I can assure you it works.
$(eval r=[`are you an angel? Cause you're perfect.`, `if you were an angel, then I'd be a devil. I just want to corrupt you.`, `if you're an angel imma start going to church so I can go to heaven and see you.`, `are you Cupid cause the moment I saw you I fell in love.`]; `Hey $(touser), ${r[Math.floor(Math.random()*r.length)]}`)
Didn't find your answer? The community is on Discord.
Ask on Discord