From 9d77de5e5d133b990983040b01cc0cb22b2f526b Mon Sep 17 00:00:00 2001 From: Jokler Date: Fri, 27 Oct 2017 20:24:44 +0200 Subject: Add missing help plugin --- src/plugins/help.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/plugins/help.rs (limited to 'src/plugins') diff --git a/src/plugins/help.rs b/src/plugins/help.rs new file mode 100644 index 0000000..c4ddcd4 --- /dev/null +++ b/src/plugins/help.rs @@ -0,0 +1,34 @@ +use irc::client::prelude::*; +use irc::error::Error as IrcError; + +use plugin::*; + +#[derive(PluginName, 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(&mut self, _: &IrcServer, _: &Message) -> Result<(), IrcError> { + panic!("Help does not implement the execute function!") + } + + fn command(&mut self, server: &IrcServer, command: PluginCommand) -> Result<(), IrcError> { + self.help(server, command) + } +} + +#[cfg(test)] +mod tests {} -- cgit v1.2.3-70-g09d2