aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2019-06-22 15:51:21 +0200
committerJokler <jokler.contact@gmail.com>2019-06-22 15:51:21 +0200
commit3592c7b6fb2522ff57c7f312b8927eb680d6dc5c (patch)
treed484a367c205afe43ba7327a888b06844fd24c0c /src/plugins/help.rs
parent237f6ebe59c90d4ceddd9af6a8a19e562d304aaa (diff)
parenta92e622a0d42911e8e46239c3bde17169ed60c92 (diff)
downloadfrippy-master.tar.gz
frippy-master.zip
Merge branch 'dev'HEADv0.5.0master
Diffstat (limited to 'src/plugins/help.rs')
-rw-r--r--src/plugins/help.rs41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/plugins/help.rs b/src/plugins/help.rs
index 7e3658d..d54008a 100644
--- a/src/plugins/help.rs
+++ b/src/plugins/help.rs
@@ -1,36 +1,51 @@
+use std::marker::PhantomData;
+
use irc::client::prelude::*;
use plugin::*;
+use FrippyClient;
-use error::FrippyError;
use error::ErrorKind as FrippyErrorKind;
+use error::FrippyError;
use failure::ResultExt;
#[derive(PluginName, Default, Debug)]
-pub struct Help;
+pub struct Help<C> {
+ phantom: PhantomData<C>,
+}
-impl Help {
- pub fn new() -> Help {
- Help {}
+impl<C: FrippyClient> Help<C> {
+ pub fn new() -> Self {
+ Help {
+ phantom: PhantomData,
+ }
}
}
-impl Plugin for Help {
- fn execute(&self, _: &IrcClient, _: &Message) -> ExecutionStatus {
+impl<C: FrippyClient> Plugin for Help<C> {
+ type Client = C;
+ fn execute(&self, _: &Self::Client, _: &Message) -> ExecutionStatus {
ExecutionStatus::Done
}
- fn execute_threaded(&self, _: &IrcClient, _: &Message) -> Result<(), FrippyError> {
+ fn execute_threaded(&self, _: &Self::Client, _: &Message) -> Result<(), FrippyError> {
panic!("Help should not use threading")
}
- fn command(&self, client: &IrcClient, command: PluginCommand) -> Result<(), FrippyError> {
- Ok(client
- .send_notice(&command.source, "Help has not been added yet.")
- .context(FrippyErrorKind::Connection)?)
+ 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, _: &IrcClient, _: PluginCommand) -> Result<String, String> {
+ fn evaluate(&self, _: &Self::Client, _: PluginCommand) -> Result<String, String> {
Err(String::from("Help has not been added yet."))
}
}