Help me with complex nightbot twitch command

Asked Mar 19, 2020·2 replies·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.

so i have a complex command that i cant figure out how to fix it, the command is

!commands add !attack $(user) has dealt $(customapi ht.tp://2g.be/twitch/randomnumber.php?=defstart=1&defend=10&start=$(1)&end=$(2)) damage to $(touser) -cd=5 $(eval Math.round(Math.random())==0? , $(user) won the fight, :`bad luck, $(touser) won the fight)

but i the thing i want to change is if that the number is >5 then i want it to say $(user) won the fight but if its <5 i want it to say bad luck, $(touser) won the fight)

if you have any solution for this please comment it below

2 replies

If the damage is equal or greater than 5, the user wins, otherwise the touser wins.

!addcom -cd=5 !attack $(eval a=Math.ceil(Math.random()*10);`$(user) has dealt ${a} damage to $(touser). `+(a>=5?`$(user) won the fight!`:`Bad luck, $(touser) won the fight.`))