diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/currency.rs | 14 | ||||
| -rw-r--r-- | src/plugins/emoji.rs | 13 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/plugins/currency.rs b/src/plugins/currency.rs index b2320ac..d29e560 100644 --- a/src/plugins/currency.rs +++ b/src/plugins/currency.rs @@ -6,14 +6,14 @@ extern crate regex; use std::io::Read; use irc::client::prelude::*; use irc::error::Error as IrcError; -use plugin::Plugin; use self::reqwest::Client; use self::reqwest::header::Connection; use self::serde_json::Value; -use PluginCommand; +use plugin::*; -register_plugin!(Currency); +#[derive(PluginName, Debug)] +pub struct Currency; struct ConvertionRequest<'a> { value: f64, @@ -62,6 +62,11 @@ impl<'a> ConvertionRequest<'a> { } impl Currency { + + pub fn new() -> Currency { + Currency {} + } + fn eval_command<'a>(&self, tokens: &'a [String]) -> Option<ConvertionRequest<'a>> { let parsed = match tokens[0].parse() { Ok(v) => v, @@ -144,5 +149,4 @@ impl Plugin for Currency { } #[cfg(test)] -mod tests { -} +mod tests {} diff --git a/src/plugins/emoji.rs b/src/plugins/emoji.rs index c7054d8..b08b1b7 100644 --- a/src/plugins/emoji.rs +++ b/src/plugins/emoji.rs @@ -2,12 +2,16 @@ extern crate unicode_names; use irc::client::prelude::*; use irc::error::Error as IrcError; -use plugin::Plugin; -use PluginCommand; -register_plugin!(Emoji); +use plugin::*; +#[derive(PluginName, Debug)] +pub struct Emoji; impl Emoji { + pub fn new() -> Emoji { + Emoji {} + } + fn emoji(&self, server: &IrcServer, content: &str, target: &str) -> Result<(), IrcError> { let mut names: Vec<String> = Vec::new(); @@ -73,5 +77,4 @@ impl Plugin for Emoji { } #[cfg(test)] -mod tests { -} +mod tests {} |
