44 lines
929 B
Rust
44 lines
929 B
Rust
|
extern crate toml;
|
||
|
|
||
|
use std::collections::BTreeMap;
|
||
|
use toml::Table;
|
||
|
|
||
|
mod plugins;
|
||
|
use plugins::Plugin;
|
||
|
use plugins::loader::PluginLoader;
|
||
|
use plugins::loader::PluginLoaderError;
|
||
|
|
||
|
pub struct Tenquestionmarks {
|
||
|
plugins: BTreeMap<String, Box<Plugin>>
|
||
|
}
|
||
|
|
||
|
impl Tenquestionmarks {
|
||
|
pub fn with_plugins (plugins: BTreeMap<String, Box<Plugin>>) -> Tenquestionmarks {
|
||
|
Tenquestionmarks {
|
||
|
plugins: plugins
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn from_configuration (configuration: Table) -> Result<Tenquestionmarks, PluginLoaderError> {
|
||
|
let loader = PluginLoader::new();
|
||
|
let plugins = loader.load_from_configuration(configuration)?;
|
||
|
Result::Ok(Tenquestionmarks::with_plugins(plugins))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub struct Channel {
|
||
|
name: String,
|
||
|
description: String,
|
||
|
topic: String
|
||
|
}
|
||
|
|
||
|
pub struct User {
|
||
|
name: String
|
||
|
}
|
||
|
|
||
|
pub struct Message {
|
||
|
sender: String,
|
||
|
target: String,
|
||
|
content: String
|
||
|
}
|