Help with different responses

Asked Sep 21, 2022·2 replies·Last activity 3 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’m having issues having nightbot type out different responses…. !addcom nightbot $(eval a=[Your 25% spooky today_1,your 69% spooky today_2,Your 1% spooky today_3];a[Math.floor(Math.random()*a.length)])
This is what I’m trying to use for it but it’s not working

2 replies

Hey @Rapid Crocodile!

I had a difficult time understanding your issue because your request is poorly formatted: you should have put the code on its own line, let things breathe; and because you're using the wrong you're/your: I couldn't understand if that was something you wanted to replace with a variable/something random.

Otherwise, the code looks correct, I think what might confuse you is that the command you're adding is called nightbot. Here's how to add such command:

!addcom !commandName $(eval a=['You\'re 25% spooky today_1', 'You\'re 69% spooky today_2', 'You\'re 1% spooky today_3']; a[Math.floor(Math.random() * a.length)];)

Just replace !commandName with the name you want to give your command.

Also, you might want to delete that nightbot command: !delcom nightbot

Here you go. Copy/paste the following into your chat:

!addcom !spooky $(user) is $(eval Math.floor((Math.random() * 100) + 1))% spooky today!