I have a json file called "GuideDB" which contains data about somethings.
GuildDB.json
{"GuideID":{"prefix":"","DJ":null,"Roles":""}}
Basically I want to access the data "Roles" in a way I can manage each element in that line, e.g.:
const myArray = GuildDB.Roles; //GuildDB.Roles is the only way to access that line.
myArray.forEach(element => {
console.log("<@&" + element + ">")
});
this code gives the error "forEach", because the array is not correctly formated.
How do I add Items in GuildDB.Roles?
client.database.guild.set(message.guild.id, {
prefix: GuildDB.prefix,
DJ: GuildDB.DJ,
Roles: GuildDB.Roles + ", " + createdRole.id, //Bug: First run always writes the comma first.
});
This will result the following:
{"GuideID":{"prefix":"","DJ":null,"Roles":", 123, 1234, 12345, 123456"}}
Which is not what I want.. and I don't care how this looks, I need to make it easy access to read/manage that data of Roles.
Hope anyone can help..