36 lines
872 B
Rust
36 lines
872 B
Rust
use crate::prelude::*;
|
|
use teloxide::types::ParseMode;
|
|
|
|
#[inline]
|
|
pub async fn get(
|
|
bot: Throttle<Bot>,
|
|
q: CallbackQuery,
|
|
db: Pool,
|
|
locale: LocaleRef,
|
|
hash: super::NameHash,
|
|
) -> crate::Result<()> {
|
|
let user_id = q.from.id.0;
|
|
let mut ids: MessageIds = q.message.as_ref().unwrap().into();
|
|
|
|
let Some(name) = Account::get_name_by_hash(user_id, &hash, &db).await? else {
|
|
bot.send_message(ids.0, locale.account_not_found.as_ref())
|
|
.reply_markup(deletion_markup(locale))
|
|
.await?;
|
|
bot.answer_callback_query(q.id).await?;
|
|
return Ok(());
|
|
};
|
|
|
|
let text = locale.show_hidden_account(&name);
|
|
|
|
ids.alter_message(
|
|
&bot,
|
|
text,
|
|
account_markup(&name, true, locale),
|
|
ParseMode::MarkdownV2,
|
|
)
|
|
.await?;
|
|
bot.answer_callback_query(q.id).await?;
|
|
|
|
Ok(())
|
|
}
|