Reputation:
I have a bot that keeps track of when someone performs the f bomb. I want to have a variable that is unique for each of the servers the bot is in that keeps track of how many f bombs someone has made since the bot entered the server. However I don't have any clue on how to do any of this. Therefore I don't have any meaningful code to show besides this:
const Discord = require('discord.js');
const bot = new Discord.Client();
const token = 'garbage';
var f_bombs = 0; //except I want one of these variables for each server it is on so server 1 can have 2 f bombs total and server 2 can have 1034 f bombs.
Upvotes: 1
Views: 976
Reputation: 519
The problem you are having right now is with your scope. You should make your scope local for each guild. I would do this with a promise like so:
const fBombs = {}
fBombs[message.guild.id] = 0
fBombs[message.guild.id]++
Upvotes: 2