some fixes

This commit is contained in:
doryan 2024-06-05 14:21:12 +04:00
parent 009a42990a
commit e52d6042a3
3 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,6 @@ pub async fn ban_member(
) -> HandlerResult {
let (bot, message, mut sender_builder): ExtractedEntityData = handler_entity.extract();
println!("дошло");
let user_id: i64 = match user.get_id() {
Some(id) => id,
None => {
@ -38,15 +37,16 @@ pub async fn ban_member(
sleep(DurationSleep::from_millis(delay)).await;
let future = || async { ban_chat_member(&bot, user_id, chat_id).await };
let callback = || async { ban_chat_member(&bot, user_id, chat_id).await };
let demote_args: (&Bot, i64, i64) = (&bot, user_id, chat_id);
sender_builder
.set_text("Невозможно забанить участника чата, демотните своими силами и попробуйте снова");
if try_restrict(future, demote_args, sender_builder.clone().build())
if try_restrict(callback, demote_args, sender_builder.clone().build())
.await
.is_err()
{
sender_builder.build().send(&bot).await?;
Ok(EventReturn::Cancel)
} else {
let banned_user_name: String = user.get_user_name(&bot, &message).await.unwrap();

View File

@ -72,7 +72,8 @@ async fn main() {
command.include(admin_commands).include(default_commands);
route.include(dice).include(command);
route.include(command);
route.include(dice);
let dispatcher = Dispatcher::builder().main_router(route).bot(bot).build();

View File

@ -34,6 +34,7 @@ impl InnerMiddleware for AdminCheck {
let response = next(request).await?;
return Ok(response);
} else {
println!("lol");
MessageSender::builder(chat_id)
.text("У ваc нет прав администратора, чтобы использовать эту команду.")
.build()