Trying to make the !vibe command better but failing

Asked Apr 28, 2022·1 reply·Last activity 4 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.

Im trying to add variables into nightbot so that it returns a specific answer if the users vibe is a number between 1 to10

$(eval a=Math.floor(Math.random()*10+1); @$(user)'s vibes are ${a}/10. and has ${a=1?▰▱▱▱▱▱▱▱▱▱ FAILED,$a=2?▰▰▱▱▱▱▱▱▱▱ FAILED,$a=3?▰▰▰▱▱▱▱▱▱▱ FAILED,$a=4?▰▰▰▰▱▱▱▱▱▱ FAILED,$a=5?▰▰▰▰▰▱▱▱▱▱ FAILED,$a=6?▰▰▰▰▰▰▱▱▱▱ PASSED,$a=7?▰▰▰▰▰▰▰▱▱▱ PASSED,$a=8?▰▰▰▰▰▰▰▰▱▱ PASSED,$a=9?▰▰▰▰▰▰▰▰▰▱ PASSED,$a=10?▰▰▰▰▰▰▰▰▰▰ PASSED`
} the Dog and Fuckwit vibe check.`)

^^ Can anyone help on this, its probably something simple that im missing

1 reply

This is a simplified version that should do the same thing you are trying.

$(eval a=Math.floor(Math.random()*10+1);c=``;for(b=1;b<11;b++){if(b<=a){c+=`▰`}else{c+=`▱`}};`@$(user)'s vibes are ${a}/10. They have ${c} ${a>5?`Passed`:`Failed`} the Dog and Fuckwit vibe check.`)