aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index e67bd1b..43c98b1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,6 +21,7 @@ use categories::Categorizable;
mod config;
use config::Config;
mod discord;
+mod matrix;
const DPS_REPORT_API: &str = "https://dps.report/uploadContent";
const WATCH_DELAY_SECONDS: u64 = 2;
@@ -78,11 +79,17 @@ fn inner_main(opts: &Opts) -> Result<()> {
SubCommand::Upload(u) => {
let permalink = upload_log(&u.path)?;
println!("{}", permalink);
+
+ let log = load_log(&u.path)?;
if let Some(d) = &config.discord {
- let log = load_log(&u.path)?;
- discord::post_link(&d.auth_token, d.channel_id, log, permalink)
+ discord::post_link(&d.auth_token, d.channel_id, &log, &permalink)
.context("Could not post link to Discord")?;
}
+
+ if let Some(m) = &config.matrix {
+ matrix::post_link(m.clone().into(), &m.room_id, &log, &permalink)
+ .context("Could not post link to Matrix")?;
+ }
}
}
Ok(())
@@ -184,11 +191,17 @@ fn handle_file(config: &Config, filename: &Path) -> Result<()> {
info!("Uploaded log, available at {}", permalink);
if let Some(d) = &config.discord {
- discord::post_link(&d.auth_token, d.channel_id, log, permalink)
+ discord::post_link(&d.auth_token, d.channel_id, &log, &permalink)
.context("Could not post link to Discord")?;
info!("Posted link to Discord");
}
+ if let Some(m) = &config.matrix {
+ matrix::post_link(m.clone().into(), &m.room_id, &log, &permalink)
+ .context("Could not post link to Matrix")?;
+ info!("Posted link to Matrix");
+ }
+
Ok(())
}