diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/dbolla | 7 |
1 files changed, 7 insertions, 0 deletions
| @@ -4,6 +4,8 @@ import asyncio | |||
| 4 | import datetime | 4 | import datetime |
| 5 | import functools | 5 | import functools |
| 6 | import logging.config | 6 | import logging.config |
| 7 | import os | ||
| 8 | |||
| 7 | 9 | ||
| 8 | from warmachine.config import Config | 10 | from warmachine.config import Config |
| 9 | from warmachine.connections.irc import AioIRC | 11 | from warmachine.connections.irc import AioIRC |
| @@ -53,6 +55,8 @@ class Bot(object): | |||
| 53 | self.load_plugin('warmachine.addons.giphy.GiphySearch') | 55 | self.load_plugin('warmachine.addons.giphy.GiphySearch') |
| 54 | self.load_plugin('warmachine.addons.standup.StandUpPlugin') | 56 | self.load_plugin('warmachine.addons.standup.StandUpPlugin') |
| 55 | 57 | ||
| 58 | # TODO: Ensure the config directory has been created | ||
| 59 | |||
| 56 | def start(self): | 60 | def start(self): |
| 57 | for connection in self.connections: | 61 | for connection in self.connections: |
| 58 | t = asyncio.ensure_future(connection.connect()) | 62 | t = asyncio.ensure_future(connection.connect()) |
| @@ -64,6 +68,9 @@ class Bot(object): | |||
| 64 | self.connections[connection] = {} | 68 | self.connections[connection] = {} |
| 65 | 69 | ||
| 66 | def on_connect(self, connection, task): | 70 | def on_connect(self, connection, task): |
| 71 | for p in self.loaded_plugins: | ||
| 72 | if hasattr(p, 'on_connect'): | ||
| 73 | p.on_connect(connection) | ||
| 67 | asyncio.ensure_future(self.process_message(connection)) | 74 | asyncio.ensure_future(self.process_message(connection)) |
| 68 | 75 | ||
| 69 | async def process_message(self, connection): | 76 | async def process_message(self, connection): |