# Discover bot internal command (ie. help)
for name, value in inspect.getmembers(self):
# Discover bot internal command (ie. help)
for name, value in inspect.getmembers(self):
- if inspect.ismethod(value) and getattr(value, '_bot_command', False):
+ if inspect.ismethod(value) and \
+ getattr(value, '_bot_command', False):
name = getattr(value, '_bot_command_name')
self.log.debug('Registered command: %s', name)
self.commands[name] = value
name = getattr(value, '_bot_command_name')
self.log.debug('Registered command: %s', name)
self.commands[name] = value
reply = ''.join(traceback.format_exc())
self.log.exception('An error occurred processing: %s: %s', body, reply)
if self.log.level < 10 and reply:
reply = ''.join(traceback.format_exc())
self.log.exception('An error occurred processing: %s: %s', body, reply)
if self.log.level < 10 and reply:
- self.nick,
- # If a room password is needed, use:
- # password=the_room_password,
- wait=True)
+ self.nick,
+ # If a room password is needed, use:
+ # password=the_room_password,
+ wait=True)
+
+ def register_bot_plugin(self, plugin_cls):
+ """Registers plugin, takes a class, the method instanciates the plugin
:param `sid.plugin.Plugin` plugin_cls: A :py:obj:`sid.plugin.Plugin` class
"""
self.plugins.append(plugin_cls(self))
for name, value in inspect.getmembers(self.plugins[-1]):
:param `sid.plugin.Plugin` plugin_cls: A :py:obj:`sid.plugin.Plugin` class
"""
self.plugins.append(plugin_cls(self))
for name, value in inspect.getmembers(self.plugins[-1]):
- if inspect.ismethod(value) and getattr(value, '_bot_command',
- False):
+ if inspect.ismethod(value) and \
+ getattr(value, '_bot_command', False):
name = getattr(value, '_bot_command_name')
self.log.debug('Registered command: %s', name)
self.commands[name] = value
def foreach_plugin(self, method, *args, **kwds):
for plugin in self.plugins:
name = getattr(value, '_bot_command_name')
self.log.debug('Registered command: %s', name)
self.commands[name] = value
def foreach_plugin(self, method, *args, **kwds):
for plugin in self.plugins:
getattr(plugin, method)(*args, **kwds)
def shutdown_plugins(self):
getattr(plugin, method)(*args, **kwds)
def shutdown_plugins(self):
self.log.info('shuting down')
for plugin in self.plugins:
self.log.debug('shuting down %s', plugin)
self.log.info('shuting down')
for plugin in self.plugins:
self.log.debug('shuting down %s', plugin)