diff --git a/Cargo.lock b/Cargo.lock index e342a56..0ff7b51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "ascendance-of-a-bookworm-bot" -version = "2.0.1" +version = "2.0.2" dependencies = [ "chrono", "confy", diff --git a/Cargo.toml b/Cargo.toml index a8ed2d4..0e210d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ascendance-of-a-bookworm-bot" -version = "2.0.1" +version = "2.0.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/bot/mod.rs b/src/bot/mod.rs index 1090c7c..5de25da 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -21,7 +21,7 @@ pub(crate) async fn run(data: Arc>){ let mut last_reload: DateTime; let mut lemmy: Lemmy; let mut login_error: bool; - let mut communities = HashMap::new(); + let mut communities; { let mut shared_data = data.write().await; @@ -38,6 +38,11 @@ pub(crate) async fn run(data: Arc>){ Err(e) => panic!("{}", e), }; login_error = false; + + communities = match lemmy.get_communities().await { + Ok(data) => data, + Err(e) => panic!("{}", e), + }; } while Utc::now().naive_local().second() != 30 { @@ -209,7 +214,7 @@ async fn handle_series<'a>( series_history.set_part(post_part_info.as_string().as_str(), part_history); data.post_history.set_series(series.slug.as_str(), series_history); - let _ = data.post_history.save_history(); + let _ = data.post_history.save_history()?; } Ok(()) }