Looking to make a specific command

Asked Feb 14, 2023·3 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 looking to make a command that picks a random name from a set of names, and then lists how many times that particular name has been given from the command.

Example Command: !blame
Example Output: Name3 has been blamed, for the 7th time!

What I have right now.

!addcom !blame $(eval a=[`Name1`,`Name2`,`Name3`,`Name4`,`Name5`,`Name6`];a[Math.floor(Math.random()*a.length)])

The above works to pick someone at random, but I'm unsure how to append the counter to it, hope I'm making sense.

Thanks in advance!

3 replies

Hey @Sturdy Moose!

I'm sorry, but a counter $(count) only counts the number of use of the command, and can't be used to count how many times a variable/name has been used.

Ah okay, appreciate the response.

Any chance there would be another way to reach my end results within nightbot?

Thanks.

Yes, create your own API and have Nightbot call it.