25 lines
551 B
Rust
25 lines
551 B
Rust
use crate::prelude::*;
|
|
|
|
#[inline]
|
|
async fn check_password(
|
|
bot: &Throttle<Bot>,
|
|
msg: &Message,
|
|
_: &DatabaseConnection,
|
|
login: &str,
|
|
) -> crate::Result<Option<Message>> {
|
|
let is_valid = validate_field(login);
|
|
if !is_valid {
|
|
let msg = bot
|
|
.send_message(msg.chat.id, "Invalid password. Try again")
|
|
.await?;
|
|
return Ok(Some(msg));
|
|
}
|
|
Ok(None)
|
|
}
|
|
|
|
crate::simple_state_handler!(
|
|
get_password,
|
|
check_password,
|
|
"Couldn't get the text of the message. Send the password again"
|
|
);
|