Added messages about no accounts found for get_account and delete commands

This commit is contained in:
StNicolay 2023-06-05 18:48:38 +03:00
parent 9720fec16a
commit d62f18980a
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
2 changed files with 14 additions and 2 deletions

View File

@ -54,8 +54,14 @@ pub async fn delete(
) -> crate::Result<()> { ) -> crate::Result<()> {
let user_id = msg.from().ok_or(NoUserInfo)?.id.0; let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
let markup = markups::account_markup(user_id, &db).await?; let markup = markups::account_markup(user_id, &db).await?;
if markup.keyboard.is_empty() {
bot.send_message(msg.chat.id, "No accounts found")
.reply_markup(deletion_markup())
.await?;
return Ok(());
}
let previous = bot let previous = bot
.send_message(msg.chat.id, "Send account name") .send_message(msg.chat.id, "Send the name of the account to delete")
.reply_markup(markup) .reply_markup(markup)
.await?; .await?;
dialogue dialogue

View File

@ -69,8 +69,14 @@ pub async fn get_account(
) -> crate::Result<()> { ) -> crate::Result<()> {
let user_id = msg.from().ok_or(NoUserInfo)?.id.0; let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
let markup = markups::account_markup(user_id, &db).await?; let markup = markups::account_markup(user_id, &db).await?;
if markup.keyboard.is_empty() {
bot.send_message(msg.chat.id, "No accounts found")
.reply_markup(deletion_markup())
.await?;
return Ok(());
}
let previous = bot let previous = bot
.send_message(msg.chat.id, "Send account name") .send_message(msg.chat.id, "Send the name of the account to get")
.reply_markup(markup) .reply_markup(markup)
.await?; .await?;
dialogue dialogue