sjstein / R8DIUM

A discord bot to manage individual run8 users
GNU General Public License v3.0
2 stars 0 forks source link

Database Pruning of Inactive Users #91

Closed Garrisonsan closed 6 months ago

Garrisonsan commented 8 months ago

For some later version of the bot, having the option (in the config file) to automatically prune inactive users from the database could be helpful for a couple of valid reasons: 1: It would force long inactives to at least check Discord and grab a new password if they desire to reactivate. While this is a "horse -> water -> drink" thing, maybe, just maybe, if operations had changed since they last were on, they'd stand a chance of noticing it by requiring some affirmative steps on Discord to gain access to the MP server. 2: More accurate usage stats by reporting active users

This request would require tailing or periodically reading the general server log (Run8.log) and snarfing UIDs/passwords to update the database with a "last seen" field or similar.

As far as a config file goes, providing a couple of parameters should suffice: inactive_days = X (default 30?) prune_inactive_users = bool (default False?)

An "enhanced" version of this feature could also specify in the config an option for the bot to remove the Discord role(s) that provided access to /show_password and/or give a role(s) indicating their inactive status. With the transition to letting Discord handle all of the command access permissions, the bot/Discord admin could decide whether or not inactive players can reactivate themselves or whether it should require staff intervention.

sjstein commented 8 months ago

I like this - brings back issue #79 a bit (at least the ability of the bot to change a user role).

I'm not crazy about having to scrape through the log file as that format is liable to change at any time (but what else is new here in Run8 Non-API world).

sjstein commented 8 months ago

I'm wondering if we integrate with your log bot @Garrisonsan - since you already have the infrastructure to parse the log file, what about you periodically write a report with UIDs and log-in dates. Then r8dium can interact only with that file.

That way when the log file changes format, only one of us (you) has to deal with the difference - not both of us

sjstein commented 7 months ago

I have a rough mock-up of how to check when a user logs in and keeping track of that info. Unfortunately, this changes the db schema (adds a "Last_Login" column), but there is no way to avoid that. I think it will be fairly easy to manually add that column in the database for the two that you keep right now (trying to avoid writing a conversion utility).

sjstein commented 6 months ago

This has been addressed in merge #109