From d72ee117e1a6b582ab49f0ce7860a24cda934ff0 Mon Sep 17 00:00:00 2001 From: Nefrace Date: Mon, 24 Oct 2022 10:41:09 +0300 Subject: [PATCH] Edited docs handler --- src/godette/dispatchers.rs | 2 +- src/godette/handlers.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/godette/dispatchers.rs b/src/godette/dispatchers.rs index 94edea2..0680ddf 100644 --- a/src/godette/dispatchers.rs +++ b/src/godette/dispatchers.rs @@ -50,7 +50,7 @@ impl Godette { lazy_static! { static ref DOC_RE: Regex = - Regex::new(r"(?i)док(ументац[а-я]+|[а-я])? ((п)?о )?(?P@?[\w\d]{1,32})") + Regex::new(r"(?i)док(ументац[а-я]+|[а-я])? ((п)?о )?(?P@?[\w\d\s]{1,32})") .unwrap(); } diff --git a/src/godette/handlers.rs b/src/godette/handlers.rs index 5fb1afa..cddd285 100644 --- a/src/godette/handlers.rs +++ b/src/godette/handlers.rs @@ -130,12 +130,13 @@ pub async fn documentation(bot: &Bot, msg: &Message, topic: String) -> ResponseR let results = utils::request_docs(&topic).await; if results.len() > 0 { - let links = results + let mut links = results .iter() .take(10) .map(|res| format!("\\- [{}]({})", escape(&res.title), res.path)) - .collect::>() - .join("\n"); + .collect::>(); + links[0] = bold(&italic(&links[0])); + let links = links.join("\n"); text = format!( "Вот что удалось мне найти в документации по запроу {}:\n\n{}", bold(&escape(&topic)),