25 lines
536 B
Rust
25 lines
536 B
Rust
use crate::prelude::*;
|
|
|
|
#[inline]
|
|
async fn check_login(
|
|
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 login. Try again")
|
|
.await?;
|
|
return Ok(Some(msg));
|
|
}
|
|
Ok(None)
|
|
}
|
|
|
|
crate::simple_state_handler!(
|
|
get_login,
|
|
check_login,
|
|
"Couldn't get the text of the message. Send the login again"
|
|
);
|