use crate::prelude::*; use tokio::task::spawn_blocking; pub async fn get_menu( bot: Throttle, q: CallbackQuery, db: DatabaseConnection, ) -> crate::Result<()> { let user_id = q.from.id.0; let msg = q.message.as_ref().unwrap(); let names: Vec = Account::get_names(user_id, &db) .await? .try_collect() .await?; if names.is_empty() { bot.edit_message_text(msg.chat.id, msg.id, "You don't have any accounts") .reply_markup(deletion_markup()) .await?; return Ok(()); } let markup = spawn_blocking(|| menu_markup_sync("get", names)).await?; bot.edit_message_text(msg.chat.id, msg.id, "Choose your account") .reply_markup(markup) .await?; Ok(()) }