I wanted to add a functionality to my bot which is to create custom uniques codes for people to invite their friend. (So we can track who invites who even with a vanity URL)
The creation of the codes works well, now I want to store everything in a JSON.
I thought of that structure (1 File per Guild):
{
"<Member ID>" :
{
"invites": 0
"Fakes": 0
"Left":0
"Invited": []
}
}
First I wanted to know if the structure is good (or if I missed anything). And second to know if I won't have any concurrency problems. I need to update the JSON every time a member do /verify, or leave the server. But I need to open the file, modify, then write the file again.. if two people do the command at the same time, what happen ?
If there is concurrency problem, would a database like SQLite3 solve the problem ? And what tables should I use in this case?
Thank you very much for your help