I need help to make a command that shows random answers with diff chances %

Hello!

I’m new in using nightbot commands and I want to make a command that shows random answers with different chances when someone types the command, I used the example in Help docs but it seems like all the answers have similar chance to appear, like

!addcom !test $(eval const responses = [‘answer1’, ‘answer2’, ‘answer3’, ‘answer4’, ‘answer5’, ‘answer6’]; responses[Math.floor(Math.random() * responses.length)]:wink:

Is it possible to give the answers diff % to appear? like 25% for answer1, 25% for answer2, 20% for answer3, 15% for answer4, 10% for answer5 and 5% for answer6?

Please help me if this is possible, any help will be appreciated.

Thank you!

Hiya, with $(eval) you can build your own logic in JavaScript that gives extra weight to certain answers in your list. If you don’t know how to code, probably the easiest solution is to add the same answer multiple times in your list.

2 Likes

thank you, I’ll try to add it multiple times then until I learn JavaScript.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.