Add graceful exits

This sets up a set of ropes and pulleys that signal the `Bot.keepalive`
function to clean things up after a quit signal has been sent. This
allows plugins to define an `on_unload` function to save any important
datas on intentional exit.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-05-24 19:16:15 -07:00
parent ffb2d4204e
commit 82e50f86d6
3 changed files with 28 additions and 13 deletions

View File

@@ -51,6 +51,9 @@ class Plugin:
async def on_message(self, conn: IrcProtocol, channel: str, who: Prefix, line: str):
pass
async def on_unload(self, conn: IrcProtocol):
pass
def load_plugin(server_config: ServerConfig, plugin_config: PluginConfig) -> Plugin:
name = plugin_config["module"]