Command Including Eval Not Working HELP PLEASE

Asked Apr 20, 2020·1 reply·Last activity 6 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.

Hello,

I am currently trying to make a new command for my channel but I am having trouble with the outcome.

My command: !addcom !chase $(user) Was Running Away From 12 And... $(eval const responses = [‘Crashed’, ‘Got Away Safely’, ‘Got Wasted’, ‘Got Busted’, ‘Was Locked Up For A Year’, ‘Got Out The Car And Started Shooting’, ‘Surrendered’, ‘Called In Back Up’]; responses[Math.floor(Math.random() * responses.length)];

Outcome: JayWillPlay_ Was Running Away From 12 And... Right-hand side of 'instanceof' is not an object

Can someone please explain to me why this happens and how to fix it?

1 reply

Invalid code causes instanceof errors, in this case probably the quotation characters you used. Fix:

!addcom -cd=5 !chase $(user) Was Running Away From 12 And... $(eval a=[`Crashed`,`Got Away Safely`,`Got Wasted`,`Got Busted`,`Was Locked Up For A Year`,`Got Out The Car And Started Shooting`,`Surrendered`,`Called In Back Up`];a[Math.floor(Math.random()*a.length)])