From 0f1de67db6d79a1d7c46193f15248621362f1612 Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 30 Dec 2023 00:53:00 +0100 Subject: [PATCH] Bugfix for moved history.toml --- src/bot.rs | 3 +++ src/lemmy.rs | 4 ++-- src/post_history.rs | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bot.rs b/src/bot.rs index 4577889..35c9902 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -49,6 +49,9 @@ pub(crate) async fn run(data: Arc>) { write.start = Utc::now(); } + let info_msg = "Bot init successful, starting normal operations".to_owned(); + write_info(info_msg); + loop { idle(&data).await; diff --git a/src/lemmy.rs b/src/lemmy.rs index 38148b2..b641577 100644 --- a/src/lemmy.rs +++ b/src/lemmy.rs @@ -46,14 +46,14 @@ pub(crate) async fn login(config: &Config) -> Result { None => { let err_msg = "Login did not return JWT token. Are the credentials valid?".to_owned(); write_error(err_msg); - return Err(()) + Err(()) } } }, status => { let err_msg = format!("Unexpected HTTP Status '{}' during Login", status); write_error(err_msg); - return Err(()) + Err(()) } } } diff --git a/src/post_history.rs b/src/post_history.rs index 3d0e245..7f8e1a3 100644 --- a/src/post_history.rs +++ b/src/post_history.rs @@ -17,10 +17,10 @@ impl SeriesHistory { let config_dir = path.parent().expect("Something went wrong with confy"); - - match Path::new(format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")).as_str()).exists() { + let path = format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")); + match Path::new(path.as_str()).exists() { true => { - let file_contents: String = match fs::read_to_string("history.toml") { + let file_contents: String = match fs::read_to_string(path.as_str()) { Ok(data) => data, Err(e) => { let err_msg = format!("{e}");