Coding help please

Asked Sep 22, 2020·2 replies·Last activity 5 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.

I have been trying to get this code to work. It should choose a random option and send that into chat. I'm getting either unexpected identifier or unexpected token.
!addcom !insult $(eval const responses = ['It's better to let someone think you are an Idiot than to open your mouth and prove it', 'You must have been born on a highway because that's where most accidents happen.', 'I'd like to see things from your point of view but I can't seem to get my head that far up my ass.', 'Why dont you slip into something more comfortable like a coma?.']; responses[Math.floor(Math.random() * responses.length)];)

2 replies

I have been trying to get this code to work. It should choose a random option and send that into chat. I’m getting either unexpected identifier or unexpected token.
!addcom !insult $(eval const responses = [‘It’s better to let someone think you are an Idiot than to open your mouth and prove it’, ‘You must have been born on a highway because that’s where most accidents happen.’, ‘I’d like to see things from your point of view but I can’t seem to get my head that far up my ass.’, ‘Why dont you slip into something more comfortable like a coma?.’]; responses[Math.floor(Math.random() * responses.length)]; ) space here because it changed it to an emoji

I believe it’s likely because you aren’t using back ticks

`

You should be using those instead of single quotes also you don’t need the last semi colon you only need one of something comes after.