fix failture in unwrap cases when the filter detect a false positive link in rewrite links functionality

This commit is contained in:
2026-03-30 18:47:05 +01:00
parent ec0766abc5
commit 53e0d9da79

View File

@@ -12,10 +12,11 @@ pub fn contain_links(msg: Message) -> bool {
pub async fn fix_links(msg: Message, bot: Bot) -> anyhow::Result<()> { pub async fn fix_links(msg: Message, bot: Bot) -> anyhow::Result<()> {
let text = msg.text().unwrap(); let text = msg.text().unwrap();
let url_and_domain = links_to_rewrite::get_domain_from_text(String::from(text)); let url_and_domain = links_to_rewrite::get_domain_from_text(String::from(text));
bot.send_message(msg.chat.id, match links_to_rewrite::filter_string(url_and_domain.0, url_and_domain.1) {
links_to_rewrite::filter_string( Some(msg_response) => {
url_and_domain.0, bot.send_message(msg.chat.id, msg_response).await?;
url_and_domain.1 }
).unwrap()).await?; None => {}
}
Ok(()) Ok(())
} }