Edited docs handler
This commit is contained in:
parent
a13d6dc0ca
commit
d72ee117e1
|
@ -50,7 +50,7 @@ impl Godette {
|
|||
|
||||
lazy_static! {
|
||||
static ref DOC_RE: Regex =
|
||||
Regex::new(r"(?i)док(ументац[а-я]+|[а-я])? ((п)?о )?(?P<topic>@?[\w\d]{1,32})")
|
||||
Regex::new(r"(?i)док(ументац[а-я]+|[а-я])? ((п)?о )?(?P<topic>@?[\w\d\s]{1,32})")
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
|
|
@ -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::<Vec<String>>()
|
||||
.join("\n");
|
||||
.collect::<Vec<String>>();
|
||||
links[0] = bold(&italic(&links[0]));
|
||||
let links = links.join("\n");
|
||||
text = format!(
|
||||
"Вот что удалось мне найти в документации по запроу {}:\n\n{}",
|
||||
bold(&escape(&topic)),
|
||||
|
|
Loading…
Reference in New Issue