expand on readme

This commit is contained in:
Adrian Malacoda 2018-02-25 03:09:53 -06:00
parent c0ee8b4d6d
commit 906b5709d0
2 changed files with 9 additions and 1 deletions

View File

@ -4,10 +4,14 @@ tenquestionmarks is an extensible, scriptable chat bot. This iteration is writte
## Configuration
Configuration is done in TOML. By default, tenquestionmarks looks for `tenquestionmarks.toml`.
As of tenquestionmarks 0.0.3, tenquestionmarks supports a limited form of live configuration reloading. tenquestionmarks monitors the configuration file and, upon detecting changes, will emit a reconfiguration event to all modules to ask them to reconfigure. Reconfiguration is implemented on a per-module basis.
## Modules
tenquestionmarks is a series of modules. Modules produce events and consume events.
In this particular iteration of tenquestionmarks, there are at most two threads spawned for a module: an event consumer thread and an event producer thread. However, most modules will either produce or consume, not both.
In this particular iteration of tenquestionmarks, there are at most two threads spawned for a module: an event loop thread (which has access to an event emitter and event receiver), and the event dispatcher thread associated with said event emitter. The event dispatcher thread takes events emitted from the event loop thread and pushes them to downstream modules' event receivers. No event dispatcher thread will be spawned for a module with no downstreams.
As of tenquestionmarks 0.0.3, each module is required to explicitly identify which modules it wishes to send and/or receive events from.
## Events
Events are things such as message, join, quit.

View File

@ -71,6 +71,10 @@ impl Tenquestionmarks {
Result::Ok(Tenquestionmarks::with_modules(modules))
}
pub fn get_module (&self, name: &str) -> Option<&Module> {
self.modules.get(name)
}
pub fn reconfigure (&self, configuration: &Table) {
for (key, module_configuration) in configuration {
if let (Some(module_configuration_table), Some(ref module)) = (module_configuration.as_table(), self.modules.get(key)) {