I have a JSON File: (invitelist.json
)
{
}
Every time the "guildMemberAdd" event gets fired off, an invite is created:
bot.channels.get('642609367195189268').createInvite({
temporary: false,
maxAge: 0,
maxUses: 0,
unique: true
},`This is ${member}'s invite link.`).then(invite => {
bot.channels.get('642609367195189268').send(invite.code);
});
How do I append
to the JSON File?:
{
"invite": {
"code": "",
"timecreated": "",
"author": ""
}
}
When a new invite is created, it'll add another invite object:
{
"invite-1": {
"code": "",
"timecreated": "",
"author": ""
},
"invite-2": {
"code": "",
"timecreated": "",
"author": ""
}
}
The address to the invitelist.json
is simply invitelist.json
. Can you please give me some code that will make it work properly? also an explanation on how it works would be awesome!
If you need more information please just kindly ask in the comments below :D
I have looked around, there's no questions on stackoverflow that answers this. Please don't mark it as duplicate. (or at least send a link to the other doppelgänger in the comments).