From 8b481420cd3c0dd02cb5671e753dc5ff4a40e7eb Mon Sep 17 00:00:00 2001 From: Jokler Date: Fri, 27 Oct 2017 15:55:11 +0200 Subject: Move help into a Plugin --- src/lib.rs | 1 + src/plugin.rs | 8 -------- src/plugins/mod.rs | 1 + 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 55b121e..5b8d479 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,6 +65,7 @@ pub fn run() { // The list of plugins in use let mut plugins = ThreadedPlugins::new(); + plugins.add(plugins::help::Help::new()); plugins.add(plugins::emoji::Emoji::new()); plugins.add(plugins::currency::Currency::new()); info!("Plugins loaded: {}", plugins); diff --git a/src/plugin.rs b/src/plugin.rs index d1a1f3d..e0a4ce2 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -121,10 +121,6 @@ impl ThreadedPlugins { return server.send_notice(&command.source, &help); } - if &command.tokens[0].to_lowercase() == "help" { - return self.send_help_message(server, &command); - } - // Check if the command is for this plugin if let Some(plugin) = self.plugins.get(&command.tokens[0].to_lowercase()) { @@ -151,10 +147,6 @@ impl ThreadedPlugins { server.send_notice(&command.source, &help) } } - - fn send_help_message(&self, server: &IrcServer, command: &PluginCommand) -> Result<(), IrcError> { - server.send_notice(&command.source, "Help has not been added yet.") - } } impl fmt::Display for ThreadedPlugins { diff --git a/src/plugins/mod.rs b/src/plugins/mod.rs index adf54b2..d07ead6 100644 --- a/src/plugins/mod.rs +++ b/src/plugins/mod.rs @@ -1,2 +1,3 @@ +pub mod help; pub mod emoji; pub mod currency; -- cgit v1.2.3-70-g09d2