better message formatting

This commit is contained in:
Joe 2025-12-14 15:20:08 -08:00
parent a1b1bffce9
commit 07ae653d49

View file

@ -125,22 +125,27 @@ impl BlogdorTheAggregator {
Ok(feed_results)
}
// will also update the successful_runs table if it posts to zulip
pub async fn post_entries(&self, posts: &[FeedEntry]) {
let FeedEntry {
feed_id, received, ..
} = posts.last().unwrap();
let mut success = true;
for post in posts.iter() {
let body = post
.body
.iter()
.next()
.cloned()
.unwrap_or("Blogdor Says: NO BODY!".to_string());
let body = post.body.as_deref().unwrap_or("Blogdor Says: NO BODY!");
let tail = if body.len() < ZULIP_MESSAGE_CUTOFF {
""
} else {
"..."
};
let content = format!(
"{body} ...\n\n---\noriginally posted to {}, on {}",
post.post_url, post.published
"{body}{tail}\n\n---\noriginally published on [{}]({})",
post.published.format("%B %e, %Y"),
post.post_url
);
let msg = ZulipMessage {
to: self.channel_id,
typ: "stream",