Is there any way to make one key different value in config.json
Like example
{
“PREMIUM”: “FIRSTID”, “SECONDID”, “THIRDID”
}
HOW CAN WE DO THIS IN config.json
file
Is there any way to make one key different value in config.json
Like example
{
“PREMIUM”: “FIRSTID”, “SECONDID”, “THIRDID”
}
HOW CAN WE DO THIS IN config.json
file
If you want an array of different values under one key, you can make an array with brackets []
like this:
{
"PREMIUM" : [ "FirstId", "SecondId", "ThirdId"],
...
}
And then to access it from your code – I don’t know how you load your config.json – it’s something like this:
// Assuming we have config object
let premiumIds = config.PREMIUM;
for(let thisId of premiumIds)
{
console.log("This is a premium ID: ", thisId)
}
// Or to get the first one
console.log("First premium ID:", premiumIds[0])
Oki leme try…
Your object Premium
contains one key, PREMIUM
which has an array of values. You should try printing it out with console.log to help you see that structure.
I don’t know if importing the JSON with require like that works, I’ve not tried it.
Anyway, if you believe that part works:
Add a line at 19 like let premiumIds = Premium.PREMIUM
Then change your for-loop to for (let thisId of premiumIds)
Can confirm that require with json does work.
Im not sure but
if (message.guild.id !== premiumIds)
might work. This makes you use Premium IDs directly
No it doesn’t work still same!
I am happy to help but you also need to put some work and some thought into it
Try adding more console.log to check what each variable is when you’re doing comparisons, like console.log("Message Guild ID", message.guild.id, "This Premium Id", thisId)
(inside the for-loop)
You can then see the log messages by opening the Glitch log. This will help you check that the code is doing what you thought. That’s all I can say, good luck!
Oki Thanks