From 0195219d5c0b0ff1486b3e6bdcd62a807d3d2932 Mon Sep 17 00:00:00 2001 From: Jokler Date: Tue, 10 Oct 2017 17:48:30 +0200 Subject: Create plugin_derive to replace the register_plugin macro --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index ca1aafe..04210a6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,11 +13,12 @@ #[macro_use] extern crate lazy_static; +#[macro_use] +extern crate plugin_derive; extern crate irc; extern crate regex; -#[macro_use] mod plugin; mod plugins; @@ -28,8 +29,7 @@ use irc::client::prelude::*; use irc::proto::Command::PRIVMSG; use irc::error::Error as IrcError; -use plugin::Plugin; -use plugin::PluginCommand; +use plugin::*; /// Runs the bot /// @@ -49,7 +49,7 @@ pub fn run() { // if they use an incorrect plugin name let plugin_names: Vec = plugins .iter() - .map(|p| p.lock().unwrap().to_string().to_lowercase()) + .map(|p| p.lock().unwrap().name().to_lowercase()) .collect(); // The main loop over received messages @@ -101,7 +101,7 @@ pub fn run() { // Check if the command is for this plugin if let Some(mut c) = command { if !c.tokens.is_empty() && - plugin.to_string().to_lowercase() == c.tokens[0].to_lowercase() { + plugin.name().to_lowercase() == c.tokens[0].to_lowercase() { // The first token contains the name of the plugin c.tokens.remove(0); -- cgit v1.2.3-70-g09d2