Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Nov 16, 2023
1 parent 03ac4ed commit 9127b1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/functions/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub async fn inline(
"Xatolik yuz berdi!",
InputMessageContent::Text(
InputMessageContentText::new(
format!("<b>{} ga oid natija mavjud emas!</b>\n{}",
q.query.clone(), "Iltimos, boshqattan ushbu qidirmoqchi bo'lgan paketingiz yozib qidirib ko'ring!")
format!("<b>{} ga oid natija mavjud emas!</b>\nIltimos, boshqattan ushbu qidirmoqchi bo'lgan paketingiz yozib qidirib ko'ring!",
q.query.clone())
)
.parse_mode(ParseMode::Html)
.disable_web_page_preview(true),
Expand Down Expand Up @@ -79,9 +79,8 @@ pub async fn inline(
)
.description(c.description.clone().unwrap())
.url(url::Url::parse(&format!("https://crates.io/crates/{}", c.id)).unwrap())
.reply_markup(kb_generate(c)
.into(),
)));
.reply_markup(kb_generate(c).into()),
));
}

bot.answer_inline_query(q.id, result).send().await?;
Expand Down
10 changes: 8 additions & 2 deletions src/utils/inmgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,21 @@ pub fn view_generate(c: &Crate) -> String {
}
));
result.push_str("🔌 <b>Cargo.toml fayliga qo'shib qo'ying:</b> \n");
result.push_str(&format!("<code>[dependencies]</code>\n<code>{} = \"{}\"</code>", c.name, c.max_version));
result.push_str(&format!(
"<code>[dependencies]</code>\n<code>{} = \"{}\"</code>",
c.name, c.max_version
));

result
}

pub fn kb_generate(c: &Crate) -> InlineKeyboardMarkup {
let mut keyboard = Keyboard::new();

keyboard.url("Crate", format!("https://crates.io/crates/{}", c.name).as_str());
keyboard.url(
"Crate",
format!("https://crates.io/crates/{}", c.name).as_str(),
);

if c.homepage.is_some() {
keyboard.url("Asosiy", &c.homepage.clone().unwrap());
Expand Down
7 changes: 3 additions & 4 deletions src/utils/kbmng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ impl Keyboard {
}

pub fn switch_inline_current(&mut self, text: &str, query: &str) -> InlineKeyboardMarkup {
self.keyboard
.last_mut()
.unwrap()
.push(InlineKeyboardButton::switch_inline_query_current_chat(text, query));
self.keyboard.last_mut().unwrap().push(
InlineKeyboardButton::switch_inline_query_current_chat(text, query),
);

self.get()
}
Expand Down

0 comments on commit 9127b1e

Please sign in to comment.