Index: Cargo.lock ================================================================== --- Cargo.lock +++ Cargo.lock @@ -2046,11 +2046,11 @@ "reqwest 0.9.24", ] [[package]] name = "rsstg" -version = "0.2.1" +version = "0.2.2" dependencies = [ "anyhow", "atom_syndication", "chrono", "config", Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "rsstg" -version = "0.2.1" +version = "0.2.2" authors = ["arcade"] edition = "2018" [dependencies] anyhow = "*" Index: src/core.rs ================================================================== --- src/core.rs +++ src/core.rs @@ -100,16 +100,11 @@ .fetch_one(&mut conn).await .with_context(|| format!("Query source:\n{:?}", &self.pool))?; drop(conn); let channel_id: i64 = row.try_get("channel_id")?; let url: &str = row.try_get("url")?; - /*let url: Cow<'a, str> = match row.try_get("url") { - Ok(x) => String::from(x).to_owned().into(), - Err(err) => bail!("Test"), - };*/ let iv_hash: Option<&str> = row.try_get("iv_hash")?; - //let url_re: Option = match row.try_get("url_re")? { let url_re = match row.try_get("url_re")? { Some(x) => Some(sedregex::ReplaceCommand::new(x)?), None => None, }; let destination = match real { @@ -162,15 +157,12 @@ if this_fetch == None || *date > this_fetch.unwrap() { this_fetch = Some(*date); }; self.tg.send( match iv_hash { Some(hash) => telegram_bot::SendMessage::new(destination, format!(" {0}", match url_re { - Some(x) => { - bail!("Regex hit, result:\n{:#?}", x.execute(url)); - url - }, - None => url, + Some(ref x) => x.execute(url).to_string(), + None => url.to_string(), }, hash)), None => telegram_bot::SendMessage::new(destination, format!("{}", url)), }.parse_mode(telegram_bot::types::ParseMode::Html)).await .context("Can't post message:")?; sqlx::query("insert into rsstg_post (source_id, posted, url) values ($1, $2, $3);") @@ -317,12 +309,10 @@ for row in queue.iter() { let source_id: i32 = row.try_get("source_id")?; let owner: i64 = row.try_get("owner")?; let next_fetch: DateTime = row.try_get("next_fetch")?; if next_fetch < now { - //let clone = self.clone(); - //clone.owner_chat(UserId::new(owner)); let clone = Core { owner_chat: telegram_bot::UserId::new(owner), ..self.clone() }; tokio::spawn(async move {