sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
948 stars 402 forks source link

Database hooks #1908

Open dgw opened 4 years ago

dgw commented 4 years ago

The problem

Plugins that maintain custom tables or external data stores (e.g. the built-in tell & remind plugins) may end up holding on to obsolete data with no way to purge it cleanly.

The solution

We're already planning to look at adding hooks for IRC events (see #1546), but I'd say Sopel also needs to let plugins register handlers for database events. Minimally, plugins should be able to respond when calls are made to bot.db.alias_nick(), bot.db.delete_nick_group(), bot.db.merge_nick_groups(), & bot.db.unalias_nick().

Alternatives

None, really. I guess periodically checking the plugin's own data against the list of nicks in the core database is an option, but aside from being an absolute kludge, we'd like for plugins not to rely on the core DB table schema (because it's likely to change in a release or two; the current one is pretty silly in places).

Notes

This appears to overlap with #1015, but that's more about letting plugins help decide which value to save when merging nick groups (e.g. combining stats from multiple users instead of overwriting).

dgw commented 2 years ago

Roadmap TBD, but not rejected. Likely to be looked at simultaneously with #1015.