Now fully trimming the text of the message in the state handlers

This commit is contained in:
StNicolay 2023-06-23 13:25:41 +03:00
parent 24420096fd
commit fff91dc498
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
3 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ where
delete_optional(&bot, handler.previous.as_ref()).await; delete_optional(&bot, handler.previous.as_ref()).await;
let text = match msg.text() { let text = match msg.text() {
Some(text) => text.trim_end(), Some(text) => text.trim(),
None => { None => {
let msg = bot.send_message(msg.chat.id, no_text_message).await?; let msg = bot.send_message(msg.chat.id, no_text_message).await?;
handler.previous = Some(msg); handler.previous = Some(msg);

View File

@ -40,7 +40,7 @@ pub async fn get_existing_name(
delete_optional(&bot, handler.previous.as_ref()).await; delete_optional(&bot, handler.previous.as_ref()).await;
let text = match msg.text() { let text = match msg.text() {
Some(text) => text.trim_end(), Some(text) => text.trim(),
None => { None => {
let msg = bot let msg = bot
.send_message( .send_message(

View File

@ -125,7 +125,7 @@ pub async fn get_user(
let mut handler = next.lock().await; let mut handler = next.lock().await;
delete_optional(&bot, handler.previous.as_ref()).await; delete_optional(&bot, handler.previous.as_ref()).await;
if let Some("/cancel") = msg.text().map(str::trim_end) { if let Some("/cancel") = msg.text().map(str::trim) {
dialogue.exit().await?; dialogue.exit().await?;
bot.send_message(msg.chat.id, "Successfully cancelled") bot.send_message(msg.chat.id, "Successfully cancelled")
.reply_markup(deletion_markup()) .reply_markup(deletion_markup())