From 8be74585a0b3704720fa63ebb94c79f0453c954a Mon Sep 17 00:00:00 2001 From: Neshura Date: Sat, 30 Dec 2023 01:22:13 +0100 Subject: [PATCH] Extend logging for new posts --- src/bot.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bot.rs b/src/bot.rs index 5ca1567..eb67a4b 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -176,7 +176,7 @@ async fn handle_series( }; let post_data = CreatePost { - name: post_lemmy_info.title, + name: post_lemmy_info.title.clone(), community_id, url: Some(post_lemmy_info.url), body: post_body, @@ -185,11 +185,15 @@ async fn handle_series( language_id: Some(LanguageId(37)), // TODO get this id once every few hours per API request, the ordering of IDs suggests that the EN Id might change in the future }; + let info = format!("Posting '{}' to {}", post_lemmy_info.title.as_str(), post_series_config.name.as_str()); + write_info(info); let post_id = lemmy.post(post_data).await?; { let read = data.read().await; if post_series_config.pin_settings.pin_new_post_community && !read.config.protected_communities.contains(&post_series_config.name) { + let info = format!("Pinning '{}' to {}", post_lemmy_info.title, post_series_config.name.as_str()); + write_info(info); let pinned_posts = lemmy.get_community_pinned(community_id).await?; if !pinned_posts.is_empty() { let community_pinned_post = &pinned_posts[0]; @@ -204,6 +208,8 @@ async fn handle_series( let read = data.read().await; if post_series_config.pin_settings.pin_new_post_local { + let info = format!("Pinning '{}' to Instance", post_lemmy_info.title); + write_info(info); let pinned_posts = lemmy.get_local_pinned().await?; if !pinned_posts.is_empty() { for pinned_post in pinned_posts {