How to use the eval command correctly

I am in doubt about how to use the EVAL command.
I have channel in the twitch I want to create a command that when the user enters a certain word the response of the bot is:
You caused certain damage eg:
! addcom! damage $ (touser) Caused $ (customapi of damage.
What I need is for the command to run and output a specific result like 15. The bot adds a specific response.
Can someone help me?

1 Like


This command setup uses $(eval) to output a random number between 1 and 100:

!addcom -cd=5 !damage $(touser) caused $(eval Math.ceil(Math.random()*100)) damage.

Thank you.
I need to know how to do it when the number 15 comes out. The bot complements the answer.

I am not sure I understand what you are asking. Could you please explain further?

When the command is type !damage
The bot responds - > you caused xx damage.
When this damage is number 15. It adds an answer
You caused xx damage. Congratulations.

!addcom -cd=5 !damage $(eval a=Math.ceil(Math.random()*100);b=a==15?` Congratulations.`:``;`You caused ${a} damage.${b}`)

<3 <3 <3 <3 Thank you

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