Bot functionality depends on internal plugins which activate and behave by configuration files and environment variables.
These plugins are available:
Some plugins offer commands input, f.e. by chat messages starting with $. Command help requests usage information from compatible plugins.
New plugins are easy to develop:
- In module
botlet.plugins:- Choose an
Abstract*Pluginclass to inherit from later - (Optional) Add
*EventDataclasses to transport information of your plugin to others
- Choose an
- Create or edit module
botlet.plugins.<PLUGIN_CATEGORY>:- Create your plugin class
<PLUGIN_NAME>Pluginand inherit from chosenAbstract*Plugin- Implement
__init__for initialization (callingsuper) - (Optional) Implement
closefor cleanup (callingsuper) - Implement
apply_eventto process incoming events - Use
_publish_event_datato publish events to other plugins - (On threaded plugin) Care for
_stoppedflag to suspend infinite loops
- Implement
- Register your plugin by function
register_plugins(workers: List[AbstractPlugin], publish_event: Callable[[Event], None], config: Dict[str,Dict[str,str]], _env: Dict[str, str])- Use incoming configuration, environment and event publish callback to create an instance
- Add this instance to event processing workers
- Create your plugin class
Don't neglect to write documentation and tests (maybe an example too).
Simple implementations to learn are plugin LoggingPlugin for events input and HeartbeatPlugin for events output.