Help with a Command

Asked Nov 22, 2024·2 replies·Last activity 1 year 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.

Hi, im completely new to creating commands for night bot. ive been making commands for a friend who streams phasmopobia. i managed to make one to randomly choose a map for the game but im trying to make one to randomly guess the ghost type but i keep getting

Unexpected string [<context>:1:159]

can anyone help/explain what to do?

$(eval const responses = ['Spirit', 'Poltergeist', 'Mare', 'Demon', 'Yokia', 'Myling', 'Raiju', 'Moroi', 'Wraith', 'Banshee', 'Revenant', 'Yurei', 'Hantu', 'Onryo,' 'Obake,' 'Deogen,' 'Phantom,' 'Jinn,' 'Shade,' 'Oni,' 'Goryo,' The Twins,' 'The Mimic,' 'Thaye,'];responses[Math.floor(Math.random() * responses.length)]; )

thank you!
the space between the last bracket and the semi colon is to stop it appearing as a emoji

2 replies

Try:

$(eval const responses = ['Spirit', 'Poltergeist', 'Mare', 'Demon', 'Yokia', 'Myling', 'Raiju', 'Moroi', 'Wraith', 'Banshee', 'Revenant', 'Yurei', 'Hantu', 'Onryo', 'Obake', 'Deogen', 'Phantom', 'Jinn', 'Shade', 'Oni', 'Goryo', 'The Twins', 'The Mimic', 'Thaye']; responses[Math.floor(Math.random() * responses.length)])

Perfect! thank you! works perfectly!