Custom Randomizer $(eval) troubles

Hi, I have currently written a custom API random Tarot Card generator, and I have used the template for the !8ball command. Here it is:

!commands add !tarot You drew $(eval const responses = [‘The Fool!’, ‘The Magician!’, ’The High Priestess!’, ‘The Empress!’, ‘The Emperor!’, ‘The Hierophant!’, ‘The Lovers!’, ’The Chariot!’, ‘Justice!’, ’Strength!’, ‘The Hermit!’, ‘Wheel of Fortune!’, ’The Hanged Man!’, ‘Death!’, ‘Temperance!’, ‘The Devil!’, ‘The Tower!’, ‘The Star!’, ‘The Moon!’, ‘The Sun!’, ‘Judgement!’, ‘The World!’]; responses[Math.floor(Math.random() * responses.length)]:wink:

When I test the command in my chat it says “invalid or unexpected token”

Is there something wrong in the HTML that I did wrong that’s causing it to glitch? Let me know if there are any solutions to this problem.

What worked for me was replacing the ‘ or ’ that was in your command with the symbol ’ which is slightly different. Try the code that I posted below.

!commands add !tarot You drew $(eval const responses = ['The Fool!', 'The Magician!', 'The High Priestess!', 'The Empress!', 'The Emperor!', 'The Hierophant!', 'The Lovers!', 'The Chariot!', 'Justice!', 'Strength!', 'The Hermit!', 'Wheel of Fortune!', 'The Hanged Man!', 'Death!', 'Temperance!', 'The Devil!', 'The Tower!', 'The Star!', 'The Moon!', 'The Sun!', 'Judgement!', 'The World!']; responses[Math.floor(Math.random() * responses.length)];)

(Edit) Thank you potatoeaterlove for guidance, in the post below, on how to properly format the text in here. Apologies for doing it wrong.


If the above code doesn’t work try this just because the command above doesn’t look like right notation either.

!commands add !tarot You drew $(eval responses=[`The Fool!`,`The Magician!`,
`The High Priestess!`,`The Empress!`,`The Emperor!`,`The Hierophant!`,
`The Lovers!`,`The Chariot!`,`Justice!`,`Strength!`,`The Hermit!`,`Wheel of Fortune!`,
`The Hanged Man!`,`Death!`,`Temperance!`,`The Devil!`,`The Tower!`,`The Star!`,
`The Moon!`,`The Sun!`,`Judgement!`,`The World!`];

For future reference @tpoles to not have the “ ` ” changed surrounding the text you want formatted properly put “ ``` ” on the top and bottom of the text.
Like this:

Text here


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.