refactor: add imports, format code and etc
This commit is contained in:
parent
51ec37b766
commit
59222bc4c6
|
@ -21,10 +21,7 @@ pub async fn unmute_member(
|
|||
if let Some(id) = user.get_id() {
|
||||
user_id = id;
|
||||
} else {
|
||||
sender_builder
|
||||
.build()
|
||||
.send(&bot)
|
||||
.await?;
|
||||
sender_builder.build().send(&bot).await?;
|
||||
|
||||
return Ok(EventReturn::Cancel);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use async_trait::async_trait;
|
||||
use telers::{
|
||||
errors::{EventErrorKind, HandlerError},
|
||||
event::telegram::{HandlerRequest, HandlerResponse},
|
||||
middlewares::{InnerMiddleware, Next}, types::Message,
|
||||
event::telegram::HandlerResponse,
|
||||
middlewares::{InnerMiddleware, Next},
|
||||
types::Message,
|
||||
Request,
|
||||
};
|
||||
|
||||
use anyhow::Error as Reject;
|
||||
|
@ -17,16 +19,12 @@ pub struct AdminCheck {}
|
|||
|
||||
#[async_trait]
|
||||
impl InnerMiddleware for AdminCheck {
|
||||
async fn call(
|
||||
&self,
|
||||
request: HandlerRequest,
|
||||
next: Next,
|
||||
) -> Result<HandlerResponse, EventErrorKind> {
|
||||
async fn call(&self, request: Request, next: Next) -> Result<HandlerResponse, EventErrorKind> {
|
||||
let (bot, message) = (request.clone().bot, request.clone().update);
|
||||
|
||||
let is_replying_dice: Option<Message> = match message.kind().message().unwrap() {
|
||||
Message::Dice(dice) => dice.reply_to_message.clone(),
|
||||
_ => None
|
||||
_ => None,
|
||||
};
|
||||
|
||||
let admins_list = get_all_admins(&bot, message.chat().unwrap().id())
|
||||
|
@ -42,7 +40,8 @@ impl InnerMiddleware for AdminCheck {
|
|||
if is_replying_dice.is_some() {
|
||||
MessageSender::builder(chat_id)
|
||||
.text("Недостаточно прав для использования данной команды.")
|
||||
.build().send(&bot)
|
||||
.build()
|
||||
.send(&bot)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue