diff --git a/src/rewrite_links/check_contain_links.rs b/src/rewrite_links/check_contain_links.rs index e5edf2d..f2e890e 100644 --- a/src/rewrite_links/check_contain_links.rs +++ b/src/rewrite_links/check_contain_links.rs @@ -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(()) }