diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/dbolla | 14 |
1 files changed, 10 insertions, 4 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | # -*- mode: python -*- | 2 | # -*- mode: python -*- |
| 3 | import asyncio | 3 | import asyncio |
| 4 | import datetime | ||
| 4 | import functools | 5 | import functools |
| 5 | import logging.config | 6 | import logging.config |
| 6 | 7 | ||
| @@ -49,7 +50,8 @@ class Bot(object): | |||
| 49 | 50 | ||
| 50 | self.loaded_plugins = [] | 51 | self.loaded_plugins = [] |
| 51 | 52 | ||
| 52 | self.load_plugin('asdf') | 53 | self.load_plugin('warmachine.addons.giphy.GiphySearch') |
| 54 | self.load_plugin('warmachine.addons.standup.StandUpPlugin') | ||
| 53 | 55 | ||
| 54 | def start(self): | 56 | def start(self): |
| 55 | for connection in self.connections: | 57 | for connection in self.connections: |
| @@ -75,18 +77,22 @@ class Bot(object): | |||
| 75 | 77 | ||
| 76 | for p in self.loaded_plugins: | 78 | for p in self.loaded_plugins: |
| 77 | self.log.debug('Calling {}'.format(p.__class__.__name__)) | 79 | self.log.debug('Calling {}'.format(p.__class__.__name__)) |
| 78 | await p.recv_msg(connection, message) | 80 | try: |
| 81 | await p.recv_msg(connection, message) | ||
| 82 | except Exception as e: | ||
| 83 | self.log.exception(e) | ||
| 84 | continue | ||
| 79 | 85 | ||
| 80 | self.log.debug('MSG {}: {}'.format( | 86 | self.log.debug('MSG {}: {}'.format( |
| 81 | connection.__class__.__name__, message)) | 87 | connection.__class__.__name__, message)) |
| 82 | 88 | ||
| 83 | def load_plugin(self, path): | 89 | def load_plugin(self, class_path): |
| 84 | """ | 90 | """ |
| 85 | Loads plugins | 91 | Loads plugins |
| 86 | """ | 92 | """ |
| 87 | from importlib import import_module | 93 | from importlib import import_module |
| 88 | 94 | ||
| 89 | mod_path, cls_name = 'warmachine.addons.giphy.GiphySearch'.rsplit('.', 1) | 95 | mod_path, cls_name = class_path.rsplit('.', 1) |
| 90 | 96 | ||
| 91 | mod = import_module(mod_path) | 97 | mod = import_module(mod_path) |
| 92 | 98 | ||