diff --git a/src/bot.rs b/src/bot.rs index 64c2239..87b66d1 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -53,7 +53,6 @@ impl Bot { .await?; for update in updates { - info!(update.id, "Received update"); self.offset.store(update.id + 1, Ordering::Relaxed); self.on_update(update).await?; } diff --git a/src/telegram/notification.rs b/src/telegram/notification.rs index 6b7072a..bccbaac 100644 --- a/src/telegram/notification.rs +++ b/src/telegram/notification.rs @@ -1,7 +1,7 @@ use std::{collections::VecDeque, iter::once}; use bon::bon; -use maud::Render; +use maud::{Render, html}; use crate::{ marktplaats::listing::Listing, @@ -45,7 +45,26 @@ impl<'a> Notification<'a> { #[builder(into)] chat_id: ChatId, reply_parameters: Option, ) -> Self { - let html = listing.render().into_string(); + let html = { + let markup = html! { + strong { a href=(listing.https_url()) { (listing.title) } } + "\n\n" + (listing.price) + @for attribute in &listing.attributes { + (attribute) + } + "\n\n" + blockquote expandable { (listing.description()) } + "\n\n" + (listing.seller) + @if listing.location.city_name.is_some() { + strong { " • " } + (listing.location) + } + }; + markup.render().into_string() + }; + let mut image_urls: VecDeque<&str> = listing .pictures .iter() diff --git a/src/telegram/render.rs b/src/telegram/render.rs index 8811510..60f2bba 100644 --- a/src/telegram/render.rs +++ b/src/telegram/render.rs @@ -5,37 +5,7 @@ use std::borrow::Cow; use maud::{Markup, Render, html}; use url::Url; -use crate::marktplaats::listing::{ - Attribute, - Condition, - Delivery, - Euro, - Listing, - Location, - Price, - Seller, -}; - -impl Render for Listing { - fn render(&self) -> Markup { - html! { - strong { a href=(self.https_url()) { (self.title) } } - "\n\n" - (self.price) - @for attribute in &self.attributes { - (attribute) - } - "\n\n" - blockquote expandable { (self.description()) } - "\n\n" - (self.seller) - @if self.location.city_name.is_some() { - strong { " • " } - (self.location) - } - } - } -} +use crate::marktplaats::listing::{Attribute, Condition, Delivery, Euro, Location, Price, Seller}; impl Render for Price { fn render(&self) -> Markup {