From 768fcc68af3cc57f52ac7117cbf325479836159a Mon Sep 17 00:00:00 2001 From: Jokler Date: Thu, 24 May 2018 02:41:46 +0200 Subject: Url: Add prefix to messages to show context --- src/plugins/url.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/url.rs b/src/plugins/url.rs index d769a0b..9724d70 100644 --- a/src/plugins/url.rs +++ b/src/plugins/url.rs @@ -162,12 +162,14 @@ impl Plugin for UrlTitles { fn execute_threaded(&self, client: &IrcClient, message: &Message) -> Result<(), FrippyError> { match message.command { - Command::PRIVMSG(_, ref content) => match self.url(content) { - Ok(title) => client - .send_privmsg(message.response_target().unwrap(), &title) - .context(FrippyErrorKind::Connection)?, - Err(e) => Err(e).context(FrippyErrorKind::Url)?, - }, + Command::PRIVMSG(_, ref content) => { + let title = self.url(content).context(FrippyErrorKind::Url)?; + let response = format!("[URL] {}", title); + + client + .send_privmsg(message.response_target().unwrap(), &response) + .context(FrippyErrorKind::Connection)?; + } _ => (), } -- cgit v1.2.3-70-g09d2