How can I set up an individual counter for commands?

I’d like to make a !bonk command that when used, counts the number of times that a specific user has been bonked. As it is with a simple $(count), it’s global. I understand that Nightbot currently cannot perform individual counters like this. Old threads I’ve searched dealing with this issue are confusing and unfortunately I’m not code savvy.

Hey @yvkay!

Well, if you could link one of the thread you didn’t understand that would help us help you.
Because it has been solved before we won’t start all over, and it’s not our job to look for the topic you found.

2 Likes

That’s fair. Here’s the community post I mentioned

Thank you, what do you not understand in it?

I create the three commands as they show but it doesn’t have a counter at all. I’m not sure if I have to add the count myself somewhere in the code.

So, in those commands, every time an user is slapped, their name is added to the list of slapped users, and when you want to know how many times an user has been slapped, it pulls the list, and then counts how many times the user’s name appears, hence why you don’t need to add the $(count) variable, I hope it’s clearer.

1 Like

This helps a little… I put in the commands but the !slap command doesn’t say how many times the person has been slapped. What command do I use to check how many times they were slapped? Does the user of the command have to use the !slap command and then also input a separate command just to see the slap count?

Yes, the command to get the total amount of slaps a user has been slapped here is !slaps, given the way how Nightbot works, how JS works and the amount of code required for these commands, there’s not really another way to do it.

Ah I see. Thankyou for taking the time to help me understand! I think I get how this works now. I appreciate it.

1 Like

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