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

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