refactor: format code
This commit is contained in:
parent
46183842bd
commit
352514d2b0
|
@ -1,19 +1,16 @@
|
|||
use telers::{
|
||||
event::telegram::HandlerResult,
|
||||
types::Message,
|
||||
Bot,
|
||||
};
|
||||
use telers::{event::telegram::HandlerResult, types::Message, Bot};
|
||||
|
||||
use crate::{
|
||||
assets::files::{HELP_COMMAND_TEXT, PRIVACY_COMMAND_TEXT},
|
||||
utils::telegram::senders::send_html,
|
||||
assets::files::{HELP_COMMAND_TEXT, PRIVACY_COMMAND_TEXT}
|
||||
};
|
||||
|
||||
#[inline]
|
||||
pub async fn help(bot: Bot, msg: Message) -> HandlerResult {
|
||||
send_html(bot, msg, HELP_COMMAND_TEXT).await
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub async fn privacy(bot: Bot, msg: Message) -> HandlerResult {
|
||||
send_html(bot, msg, PRIVACY_COMMAND_TEXT).await
|
||||
}
|
||||
|
||||
|
|
|
@ -6,16 +6,12 @@ use telers::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
assets::files::UNMUTE_COMMAND_HELP,
|
||||
actions::unmute::unmute_member,
|
||||
assets::files::UNMUTE_COMMAND_HELP,
|
||||
types::{enums::target_user::TargetUser, structs::handler_entity::HandlerEntity},
|
||||
utils::{
|
||||
general::cast_boxed_array::cast_boxed,
|
||||
telegram::{
|
||||
args_parsers::get_user,
|
||||
data_getters::get_chat_data,
|
||||
senders::send_html
|
||||
},
|
||||
telegram::{args_parsers::get_user, data_getters::get_chat_data, senders::send_html},
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -24,13 +20,9 @@ pub async fn unmute(bot: Bot, message: Message, command: CommandObject) -> Handl
|
|||
|
||||
let args: Vec<&'static str> = cast_boxed(command.args);
|
||||
|
||||
let target_user: TargetUser = get_user(
|
||||
handler_entity.clone(),
|
||||
args.first().copied(),
|
||||
&mut 0,
|
||||
);
|
||||
let target_user: TargetUser = get_user(handler_entity.clone(), args.first().copied(), &mut 0);
|
||||
|
||||
if args.is_empty() && !target_user.exist(){
|
||||
if args.is_empty() && !target_user.exist() {
|
||||
send_html(bot, message, UNMUTE_COMMAND_HELP).await?;
|
||||
|
||||
return Ok(EventReturn::Cancel);
|
||||
|
@ -44,4 +36,3 @@ pub async fn unmute(bot: Bot, message: Message, command: CommandObject) -> Handl
|
|||
|
||||
Ok(EventReturn::Finish)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ impl TimeMetrics {
|
|||
_ => Self::Days(duration),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn extract(self) -> i64 {
|
||||
match self {
|
||||
Self::Minutes(min) => min,
|
||||
|
@ -36,6 +37,7 @@ impl TimeMetrics {
|
|||
Self::Mounths(mon) => mon,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_word_declensions(self) -> (impl Into<String>, impl Into<String>, impl Into<String>) {
|
||||
match self {
|
||||
Self::Minutes(_) => ("минута", "минуты", "минут"),
|
||||
|
|
|
@ -3,7 +3,7 @@ use telers::{errors::SessionErrorKind as ErrorKind, event::EventReturn, types::C
|
|||
use crate::types::structs::message_sender::MessageSender;
|
||||
use std::future::Future;
|
||||
|
||||
use super::{admin_check::is_admin, rights_control::demote_user, data_getters::get_all_admins};
|
||||
use super::{admin_check::is_admin, data_getters::get_all_admins, rights_control::demote_user};
|
||||
|
||||
const DEMOTE_FAILURE_MESSAGE: &str = "Команда не может быть выполнена: \
|
||||
не удалось удалить административные привилегии пользователя.";
|
||||
|
|
Loading…
Reference in New Issue