Im working on a Discord bot with commands for premium members.
buyers.json:
buyers.json:
{
  "buyers": [
    {
      "id": "331499609509724162"
    },
    {
      "id": "181336616164392960"
    },
    {
      "id": "266389854122672128"
    }
  ]
}Snippet of the code:
case "spotify":
            var uID = message.author.id;
            for (let i = 0; i < ftpr.buyers.length; i++) {
                if (uID === ftpr.buyers[i]) {
                    var _embed = new Discord.RichEmbed()
                        .setTitle("Spotify")
                        .addField("Username", "testsda@yahoo.com")
                        .addField("Password", "ithastobe8")
                        .setColor(0x00FFFF)
                        .setFooter("Sincerely, LajgaardMoneyService")
                        .setThumbnail(message.author.avatarURL);
                    message.author.send(_embed);
                    console.log(message.author + " Just used the command !spotify")
                }
                
            }
            
            break;Everything works except the for loop and if statement. Its like it aint getting the id's.
var fptr = require("./buyers.json");
EDIT: my json file looks like this:
{
  "buyers": [
    {
      "id": "331499609509724162"
    },
    {
      "id": "181336616164392960"
    },
    {
      "id": "266389854122672128"
    }
  ]
}
It has some id's from people.
In my app.js var file = require("./file.json"); is used to import. Lets say that I change one of the ID's then I have to reload the app.js to update it. If I don't my checking mechanism isn't using the updated version of file.json
How should I go about updating the file every time that a function is being used?
 
     
    