aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-05-24 02:41:46 +0200
committerJokler <jokler.contact@gmail.com>2018-05-24 03:20:58 +0200
commit768fcc68af3cc57f52ac7117cbf325479836159a (patch)
tree9f35e14e5068cae8e30988f819f5f1abefd07c82 /src
parent1a1a1d47dab61960ac8cfeb0258ca292bc465b52 (diff)
downloadfrippy-768fcc68af3cc57f52ac7117cbf325479836159a.tar.gz
frippy-768fcc68af3cc57f52ac7117cbf325479836159a.zip
Url: Add prefix to messages to show context
Diffstat (limited to 'src')
-rw-r--r--src/plugins/url.rs14
1 files changed, 8 insertions, 6 deletions
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)?;
+ }
_ => (),
}