Add on_load for plugins
This asynchronous function is called on all plugins right before the IRC connection is made. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -45,6 +45,8 @@ class Bot:
|
||||
self.server_config.port,
|
||||
self.server_config.use_ssl,
|
||||
)
|
||||
log.info("Initializing plugins")
|
||||
await asyncio.gather(*[plugin.on_load() for plugin in self.plugins])
|
||||
self.connection = IrcProtocol([server], self.server_config.nick, loop=loop)
|
||||
# Register events
|
||||
# self.connection.register("*", self.on_message)
|
||||
|
||||
@@ -51,6 +51,9 @@ class Plugin:
|
||||
async def on_message(self, conn: IrcProtocol, channel: str, who: Prefix, line: str):
|
||||
pass
|
||||
|
||||
async def on_load(self):
|
||||
pass
|
||||
|
||||
async def on_unload(self, conn: IrcProtocol):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user