Split up get_account_name into 2 states: get_new_name and get_existing_name
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
errors::NoUserInfo, markups::deletion_markup, models::DecryptedAccount, state::NameCheckKind,
|
||||
Handler, MainDialogue, State,
|
||||
errors::NoUserInfo, markups::deletion_markup, models::DecryptedAccount, Handler, MainDialogue,
|
||||
State,
|
||||
};
|
||||
use sea_orm::prelude::*;
|
||||
use teloxide::{adaptors::Throttle, prelude::*};
|
||||
@ -101,10 +101,7 @@ pub async fn add_account(
|
||||
) -> crate::Result<()> {
|
||||
let previous = bot.send_message(msg.chat.id, "Send account name").await?;
|
||||
dialogue
|
||||
.update(State::GetAccountName(
|
||||
Handler::new(get_account_name, previous),
|
||||
NameCheckKind::NewAccountName,
|
||||
))
|
||||
.update(State::GetNewName(Handler::new(get_account_name, previous)))
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
errors::NoUserInfo,
|
||||
markups::{self, deletion_markup},
|
||||
state::NameCheckKind,
|
||||
Handler, MainDialogue, State,
|
||||
};
|
||||
use entity::prelude::*;
|
||||
@ -60,10 +59,10 @@ pub async fn delete(
|
||||
.reply_markup(markup)
|
||||
.await?;
|
||||
dialogue
|
||||
.update(State::GetAccountName(
|
||||
Handler::new(get_account_name, previous),
|
||||
NameCheckKind::MustExist,
|
||||
))
|
||||
.update(State::GetExistingName(Handler::new(
|
||||
get_account_name,
|
||||
previous,
|
||||
)))
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
errors::NoUserInfo,
|
||||
markups::{self, deletion_markup},
|
||||
state::NameCheckKind,
|
||||
Handler, MainDialogue, State,
|
||||
};
|
||||
use cryptography::prelude::*;
|
||||
@ -75,10 +74,10 @@ pub async fn get_account(
|
||||
.reply_markup(markup)
|
||||
.await?;
|
||||
dialogue
|
||||
.update(State::GetAccountName(
|
||||
Handler::new(get_account_name, previous),
|
||||
NameCheckKind::MustExist,
|
||||
))
|
||||
.update(State::GetExistingName(Handler::new(
|
||||
get_account_name,
|
||||
previous,
|
||||
)))
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user