diff options
| author | Jokler <jokler.contact@gmail.com> | 2017-12-15 19:27:43 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2017-12-15 19:27:43 +0100 |
| commit | b4c1722bbee9fa822a6063cbb0540c0a7fb2e430 (patch) | |
| tree | 35c00055654603d7092b526e761b377e901cc1dd /bin/main.rs | |
| parent | d0a417cd9569d135a1dab0d49fe2f5dfbc65bad3 (diff) | |
| download | frippy-b4c1722bbee9fa822a6063cbb0540c0a7fb2e430.tar.gz frippy-b4c1722bbee9fa822a6063cbb0540c0a7fb2e430.zip | |
Add option for disabled plugins in the toml files
Diffstat (limited to 'bin/main.rs')
| -rw-r--r-- | bin/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/main.rs b/bin/main.rs index 08787ff..420e016 100644 --- a/bin/main.rs +++ b/bin/main.rs @@ -81,6 +81,14 @@ fn main() { // Open a connection and add work for each config for config in configs { + + let mut disabled_plugins = None; + if let &Some(ref options) = &config.options { + if let Some(disabled) = options.get("disabled_plugins") { + disabled_plugins = Some(disabled.split(",").map(|p| p.trim()).collect::<Vec<_>>()); + } + } + let mut bot = frippy::Bot::new(); bot.add_plugin(plugins::Help::new()); bot.add_plugin(plugins::Url::new(1024)); @@ -88,6 +96,14 @@ fn main() { bot.add_plugin(plugins::Currency::new()); bot.add_plugin(plugins::KeepNick::new()); + if let Some(disabled_plugins) = disabled_plugins { + for name in disabled_plugins { + if let None = bot.remove_plugin(name) { + error!("{:?} was not found - could not disable", name); + } + } + } + bot.connect(&mut reactor, &config); } |
