35 lines
930 B
Rust
35 lines
930 B
Rust
use crate::prelude::*;
|
|
use teloxide::types::ParseMode;
|
|
|
|
pub async fn get(
|
|
bot: Throttle<Bot>,
|
|
q: CallbackQuery,
|
|
db: DatabaseConnection,
|
|
hash: super::NameHash,
|
|
) -> crate::Result<()> {
|
|
let user_id = q.from.id.0;
|
|
let msg = q.message.as_ref().unwrap();
|
|
|
|
let name = match name_from_hash(&db, user_id, &hash).await? {
|
|
Some(name) => name,
|
|
None => {
|
|
bot.edit_message_text(
|
|
msg.chat.id,
|
|
msg.id,
|
|
"Account wan't found. Select another one",
|
|
)
|
|
.reply_markup(menu_markup("get", user_id, &db).await?)
|
|
.await?;
|
|
return Ok(());
|
|
}
|
|
};
|
|
|
|
let text = format!("Name:\n`{name}`\nLogin:\n\\*\\*\\*\nPassword:\n\\*\\*\\*");
|
|
bot.send_message(msg.chat.id, text)
|
|
.reply_markup(account_markup(&name, true))
|
|
.parse_mode(ParseMode::MarkdownV2)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|