Updated /get_accounts to use a write! macro to concatenate the accounts

This commit is contained in:
StNicolay 2023-05-30 17:38:11 +03:00
parent a0920ba3d3
commit ee815e5f61
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -1,6 +1,7 @@
use crate::{entity::prelude::Account, errors::NoUserInfo, handlers::markups::deletion_markup};
use futures::TryStreamExt;
use sea_orm::prelude::*;
use std::fmt::Write;
use teloxide::{adaptors::Throttle, prelude::*, types::ParseMode};
/// Handles /get_accounts command by sending the list of copyable account names to the user
@ -22,7 +23,7 @@ pub async fn get_accounts(
};
account_names
.try_for_each(|name| {
result.push_str(&format!("\n`{}`", name));
write!(result, "\n`{name}`").unwrap();
async { Ok(()) }
})
.await?;