aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/tell/mod.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-03-19 03:26:09 +0100
committerJokler <jokler.contact@gmail.com>2018-03-19 03:26:09 +0100
commit0e84a9c5cad2c5b8d4a2a9cff67c106ce4a47dfa (patch)
treec6f20859805190a7beb6366a5cee89f23cba407e /src/plugins/tell/mod.rs
parent47627f9219c75290125f980761b4ec9b5f6fe1f4 (diff)
downloadfrippy-0e84a9c5cad2c5b8d4a2a9cff67c106ce4a47dfa.tar.gz
frippy-0e84a9c5cad2c5b8d4a2a9cff67c106ce4a47dfa.zip
Use a prefix from the config instead of the nick
Diffstat (limited to 'src/plugins/tell/mod.rs')
-rw-r--r--src/plugins/tell/mod.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/plugins/tell/mod.rs b/src/plugins/tell/mod.rs
index e8a2bb6..b3c2195 100644
--- a/src/plugins/tell/mod.rs
+++ b/src/plugins/tell/mod.rs
@@ -45,7 +45,7 @@ impl<T: Database> Tell<T> {
command: PluginCommand,
) -> Result<String, TellError> {
if command.tokens.len() < 2 {
- return Ok(self.invalid_command(client));
+ return Ok(self.invalid_command().to_owned());
}
let mut online = Vec::new();
@@ -168,20 +168,14 @@ impl<T: Database> Tell<T> {
Ok(())
}
- fn invalid_command(&self, client: &IrcClient) -> String {
- format!(
- "Incorrect Command. \
- Send \"{} tell help\" for help.",
- client.current_nickname()
- )
+ fn invalid_command(&self) -> &str {
+ "Incorrect Command. \
+ Send \"tell help\" for help."
}
- fn help(&self, client: &IrcClient) -> String {
- format!(
- "usage: {} tell user message\r\n\
- example: {0} tell Foobar Hello!",
- client.current_nickname()
- )
+ fn help(&self) -> &str {
+ "usage: {} tell user message\r\n\
+ example: {0} tell Foobar Hello!"
}
}
@@ -215,7 +209,7 @@ impl<T: Database> Plugin for Tell<T> {
fn command(&self, client: &IrcClient, command: PluginCommand) -> Result<(), FrippyError> {
if command.tokens.is_empty() {
return Ok(client
- .send_notice(&command.source, &self.invalid_command(client))
+ .send_notice(&command.source, &self.invalid_command())
.context(FrippyErrorKind::Connection)?);
}
@@ -223,7 +217,7 @@ impl<T: Database> Plugin for Tell<T> {
Ok(match command.tokens[0].as_ref() {
"help" => client
- .send_notice(&command.source, &self.help(client))
+ .send_notice(&command.source, &self.help())
.context(FrippyErrorKind::Connection)
.into(),
_ => match self.tell_command(client, command) {