Skip to content
Advertisement

My discord counting bot is Not doing server by server but every single server combined

I need help with a discord counting bot. Whatever server it is in, it has the same counter number. what I mean is that they are all paired and do the same count instead of it being server by server.

Here is the main part (not all of it), I just need to learn to have the servers separate from one another:

JavaScript

Advertisement

Answer

I’m not sure what this counting bot is or how you store your data. However, you can get the server id from the message by accessing message.guild.id. It means that you can check this id before you do anything to the server’s “count”.

You can use an object with the server ids as its keys like this:

JavaScript

The following code increases the counter of the server it’s accessed from by one:

JavaScript

Edit: As you’ve updated your question with your code, here’s how I’d add different counters for different servers:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement