pass_manager/src/state/get_password.rs

25 lines
551 B
Rust
Raw Normal View History

use crate::prelude::*;
2023-05-03 18:08:14 +00:00
2023-07-16 20:12:37 +00:00
#[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)
2023-05-03 18:08:14 +00:00
}
2023-07-16 20:12:37 +00:00
crate::simple_state_handler!(
get_password,
check_password,
"Couldn't get the text of the message. Send the password again"
);