How do you make a coinflip command with nightbot?

Asked May 23, 2021·6 replies·Last activity 5 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.

I have so much trouble making a coin flip command and I just can't figure it out please can anyone help me?

6 replies

!commands add !coinflip $(eval Math.random() < 0.5 ? 'heads' : 'tails')

It says invalid or unexpected token when I add that command.

If you haven't changed anything, it should work fine.

I havent but when I type the : in $(eval Math.random() < 0.5 ? 'heads' : 'tails') it auto turns into a emote bc when you type : it makes an emote on twitch. Therefor it doesn’t work.

Hey @Rusty Peacock!

That counts as a change, and it's due to your settings.
If you remove the spaces that should prevent that from happening:

!addcom !coinflip $(eval Math.random()<0.5?`heads`:`tails`)

Oh my gosh thank you now it’s working! :D

Didn't find your answer? The community is on Discord.

Ask on Discord