use std::marker::PhantomData; use irc::client::prelude::*; use plugin::*; use FrippyClient; use error::ErrorKind as FrippyErrorKind; use error::FrippyError; use failure::ResultExt; #[derive(PluginName, Default, Debug)] pub struct Help { phantom: PhantomData, } impl Help { pub fn new() -> Self { Help { phantom: PhantomData, } } } impl Plugin for Help { type Client = C; fn execute(&self, _: &Self::Client, _: &Message) -> ExecutionStatus { ExecutionStatus::Done } fn execute_threaded(&self, _: &Self::Client, _: &Message) -> Result<(), FrippyError> { panic!("Help should not use threading") } fn command(&self, client: &Self::Client, command: PluginCommand) -> Result<(), FrippyError> { client .send_notice( &command.source, "Available commands: help, tell, factoids, remind, quote, unicode\r\n\ For more detailed help call help on the specific command.\r\n\ Example: 'remind help'", ) .context(FrippyErrorKind::Connection)?; Ok(()) } fn evaluate(&self, _: &Self::Client, _: PluginCommand) -> Result { Err(String::from("Help has not been added yet.")) } }