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