aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-03-12 16:02:51 +0100
committerJokler <jokler.contact@gmail.com>2018-03-12 16:02:51 +0100
commit909cabe9280722e43c5fb283f768051bb85e1890 (patch)
tree506ac34b7e22cdb95568cef9e649ee64cb3b0fdb /src/plugins/help.rs
parent15e855ddecfdac31ddda26b12fcfd1a142a0ec21 (diff)
parent8e40e919aca8b8592be43e2c5bbcc0717bf14a6b (diff)
downloadfrippy-909cabe9280722e43c5fb283f768051bb85e1890.tar.gz
frippy-909cabe9280722e43c5fb283f768051bb85e1890.zip
Merge branch 'dev'
Diffstat (limited to 'src/plugins/help.rs')
-rw-r--r--src/plugins/help.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/plugins/help.rs b/src/plugins/help.rs
index 8f3fb4d..7e3658d 100644
--- a/src/plugins/help.rs
+++ b/src/plugins/help.rs
@@ -1,34 +1,36 @@
use irc::client::prelude::*;
-use irc::error::Error as IrcError;
use plugin::*;
-#[derive(PluginName, Debug)]
+use error::FrippyError;
+use error::ErrorKind as FrippyErrorKind;
+use failure::ResultExt;
+
+#[derive(PluginName, Default, Debug)]
pub struct Help;
impl Help {
pub fn new() -> Help {
Help {}
}
-
- fn help(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
- server.send_notice(&command.source, "Help has not been added yet.")
- }
}
impl Plugin for Help {
- fn is_allowed(&self, _: &IrcServer, _: &Message) -> bool {
- false
+ fn execute(&self, _: &IrcClient, _: &Message) -> ExecutionStatus {
+ ExecutionStatus::Done
}
- fn execute(&self, _: &IrcServer, _: &Message) -> Result<(), IrcError> {
- panic!("Help does not implement the execute function!")
+ fn execute_threaded(&self, _: &IrcClient, _: &Message) -> Result<(), FrippyError> {
+ panic!("Help should not use threading")
}
- fn command(&self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> {
- self.help(server, command)
+ fn command(&self, client: &IrcClient, command: PluginCommand) -> Result<(), FrippyError> {
+ Ok(client
+ .send_notice(&command.source, "Help has not been added yet.")
+ .context(FrippyErrorKind::Connection)?)
}
-}
-#[cfg(test)]
-mod tests {}
+ fn evaluate(&self, _: &IrcClient, _: PluginCommand) -> Result<String, String> {
+ Err(String::from("Help has not been added yet."))
+ }
+}