Open
Description
I've seen quite some bots implementing some admin system of their own, often having people with the same ID being an admin by default, who then can give other people admin access.
Then they have to deal with loading and saving that stuff.
Since this kind of functionality is common, and people don't get promoted or demoted a lot, and there usually only are a few admins, a simple JSON file will do just fine.
I'll do it like this:
- The developer tells the library where to find the JSON file with a list of admins. (through an extra option in the constructor)
- We load the JSON file and cache the list of admins.
- We watch the file for changes and update the cache accordingly.
- Error while reading file? We just keep watching it and send an error in the console.
- If someone gets promoted or demoted, we update the JSON file. If we're overwriting a JSON file we cannot parse, create a backup.
- What if there already is a .bak file? We put a timestamp in the filename to prevent this.
- The developer isn't happy with our solution? We provide an option for them to write their own solution. They will have 3 tasks: load, save and watch whatever thing they are using.
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo