I realise I have been quiet on these issues for some time.
I am running multiple test servers and have not been able to replicate the described issues.
I have verified the code. The configuration is written to disk when you make a change. In addition, the configuration is written to disk both on an hourly schedule and can also happen when various regular processes occur. If the bot is restarted then the configuration is read from the disk.
I have also introduced some logging which confirms that these processes of saving and retrieving the configurations are being followed correctly.
In these logs I have identified some unhandled errors:
Some errors where messages could not be sent - this is due to the bot missing 'SEND MESSAGE' permissions. This error is now caught and logged, though did not crash the bot.
Some functions to remove alerts being called more often than necessary.
Neither of these problems are suspected to have impacted the reported problems.
The only reasons for configuration to be removed:
If a user has sent commands to remove that configuration.
If the configuration files are being restored to an earlier date.
There has been no restoration of previous files to my knowledge, and only I have access to do this.
I am now logging the commands sent by users to the bot - as I suspect this to be the reason why. Note that only users with Manage Message permissions can remove configuration.
If you observe these issues happening, run !config and message it to me on discord (dr.lameos#4911) . Let me know what items are unexpectedly missing from your configuration. I will then check the log to see what commands and configuration activities have been performed on your channel.
I am aware that sometimes the bot does not edit an existing message and posts a new one. This happens by design if the bot receives an error from the discord api when trying to edit the existing message. I can't think of any better way of handling this - again this is logged.
EDIT: I have now observed these issues occurring on my test server. I will investigate further.