fix failture in unwrap cases when the filter detect a false positive link in rewrite links functionality
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user