Why doesn't this work?

Asked Jul 25, 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.

can anyone explain to me why this doesnt work. it supposed to say : _ _ _ _ has slapped _ _ _ _'s (choose a scentence out of the eval)

!addcom !slap $(user) has slapped $(touser)\'s $(eval const responses = ['butt. $(touser) blushed #0w0# and walked away with a smile.','face so hard $(touser) died. $(user) went to jail.','face so hard $(touser) flew to space.','butt. $(touser) called the cop and $)user) was fined for ASSault.']; responses[Math.floor(Math.random() * responses.length)]; )

2 replies

Probably "$)user)" causing premature eval escape. Try this.

!addcom -cd=5 !slap $(user) has slapped $(touser)'s $(eval u=`$(user)`;t=decodeURIComponent(`$(touser)`);a=[`butt. ${t} blushed #0w0# and walked away with a smile.`,`face so hard ${t} died. ${u} went to jail.`,`face so hard ${t} flew to space.`,`butt. ${t} called the cop and ${u} was fined for ASSault.`];a[Math.floor(Math.random()*a.length)])

Thanks @Deft Penguin it works fine and i wouldnt have been able to fix it without you 🙂