| |
Methods defined here:
- __init__(self, bot)
- _find_module(self, modname)
- _find_obj_in_module(self, module_name, object_name)
- _find_obj_in_module_path(self, object_name)
- _load(self)
- _unload(self)
- die(self)
- unload all modules, but keep self.modules_list populated
This should only be used on bot exit. This is so modules can
be unloaded properly, yet the modules_list is stored for the
next startup
- find_object(self, obj_name)
- find an object in the modules and return it
takes the object pathname (as in 'module.command' or just 'command')
and returns the python object, along with its perm_object.
- get_list(self)
- return a list of loaded modules in search-path order
each item in the returned list is a tuple:
(modulename, python_module, bot_module)
Here, python_module is the python_module in which the bot module
is defined. bot_module is the class instance that IS the bot module.
- load(self, name)
- load a bot module by name
- reload(self, name)
- reload a bot module by name
This differs from "load; reload;" only in that the path
order is preserved un successful reload
- unload(self, name)
- unload a bot module by name
Data and non-method functions defined here:
- __doc__ = None
- __module__ = 'kibot.ModuleManager'
- _list_split_re = <_sre.SRE_Pattern object>
- _primary_modules = ['base', 'auth', 'irc']
- _stash_attrs = ['modules_list']
- _stash_file = 'modules.repr'
- _stash_format = 'repr'
- _tmp_key = 'ModuleManagerData'
Methods inherited from kibot.BaseModule.BaseModule:
- _del_handlers(self, priority=0, prefix='_on_')
- This "undoes" self._set_handlers
- _get_handlers(self, prefix)
- return a list of all event types for which it looks like
the module has handlers. If the module has defined _on_join and
_on_kick, then this will return ['join', 'kick']
if the attribute self._handlers is defined, it will be returned
instead
- _get_stasher(self, file=None, format=None, **kwargs)
- #_stash_file = 'foo.pickle' # will appear in the "data_dir"
- _set_handlers(self, priority=0, prefix='_on_')
- set handlers for all methods with prefix <prefix>
For example, if the method _on_join is defined, then that method
will be registered as handler for the "join" event.
If the attribute self._handlers is defined, it will be used instead.
each element of the self._handlers list should be the event type.
def _handle_join(self, conn, event): pass
def _handle_kick(self, conn, event): pass
def _handle_part(self, conn, event): pass
self._handlers = ['join', 'kick']
_set_handlers(prefix='_handle_')
In this case, only the first two will be set. If self._handlers
were not defined, then all three would be set.
- _stash(self, default=<class kibot.BaseModule.NoDefault>)
- Store the attributes listed in self._stash_attrs in a stasher.
One will be created if necessary. If a value isn't set and
a default is provided, that value will be used.
- _unstash(self, default=<class kibot.BaseModule.NoDefault>)
- Reload the attributes listed in self._stash_attrs from the
stasher. If the attribute was not in the stasher (or if the file
didn't exist) then the attribute will be set to 'default'. If
default is not provided, then the attribute will not be set at all.
|