Compare commits

..

No commits in common. "c2aebcd509d99ec4cc4edace0e33cfb46fdb162b" and "4277fc5523228cefc27a7c3f0e5dc3a9640aed89" have entirely different histories.

3 changed files with 1 additions and 48 deletions

12
Cargo.lock generated
View File

@ -67,7 +67,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f50776554130342de4836ba542aa85a4ddb361690d7e8df13774d7284c3d5c2"
dependencies = [
"include_dir",
"itertools 0.10.5",
"itertools",
"proc-macro-error2",
"proc-macro2",
"quote",
@ -852,7 +852,6 @@ dependencies = [
"enum_stringify",
"envconfig",
"futures",
"itertools 0.14.0",
"log",
"mongodb",
"pretty_env_logger",
@ -1337,15 +1336,6 @@ dependencies = [
"either",
]
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.15"

View File

@ -14,7 +14,6 @@ dotenvy = "0.15.7"
enum_stringify = "0.6.3"
envconfig = "0.11.0"
futures = "0.3.31"
itertools = "0.14.0"
log = "0.4.27"
mongodb = "3.2.3"
pretty_env_logger = "0.5.0"

View File

@ -1,4 +1,3 @@
use itertools::Itertools;
use teloxide::{
prelude::*,
utils::{command::BotCommands, render::RenderMessageTextHelper},
@ -37,10 +36,6 @@ pub enum AdminCommands {
SetAlternative { literal: String, variant: String },
/// Sets chat where this message entered as support's chats
SetChat,
/// Shows user count and lists some of them
Users,
/// Cancel current action and sets user state to default
Cancel,
}
pub async fn admin_command_handler(
@ -125,37 +120,6 @@ pub async fn admin_command_handler(
bot.send_message(msg.chat.id, "ChatId is set!").await?;
Ok(())
}
AdminCommands::Users => {
let users = db.get_users().await?;
let count = users.len();
let user_list = users
.into_iter()
.take(5)
.map(|u| {
format!(
" {}{}{}",
u.first_name,
u.last_name.map_or("".into(), |l| format!(" {l}")),
u.username
.map_or("".into(), |username| format!(" ({username})")),
)
})
.join("\n");
bot.send_message(
msg.chat.id,
format!("Users count: {count}\nList:\n{user_list}"),
)
.await?;
Ok(())
}
AdminCommands::Cancel => {
dialogue.exit().await?;
bot.send_message(msg.chat.id, "canceled current action")
.await?;
Ok(())
}
}
}