Skip to main content
Removed tags from title
Link
Federico Grandi
  • 6.8k
  • 5
  • 34
  • 51

(Discord.js) Node JavaScript. Fetching and Savingsaving user ID'sIDs to individual guilds

Source Link

(Discord.js) Node JavaScript. Fetching and Saving user ID's to individual guilds

Basically what I want to do is to read a json file and firstly fetch a guild's ID from it and then search for a user's ID in this guild.

Let's say this is the sample of json file:

{Guilds ID}:
    {Users ID}:
        Value: "Yes"
        Value2: "No"
    {Users ID}:
        Value: "Yes"
        Value2: "No"
{Guilds ID}:
    {Users ID}:
        Value: "Yes"
        Value2: "No"
    {Users ID}:
        Value: "Yes"
        Value2: "No"

I tried using:

Variable[message.guild.id] = {
    User: "User ID"
    }

but this won't really work as I can't get variables only to specific user's ID like this. I probably made it complicated but can someone please help? I also want to save the file. Thanks.