diff --git a/src/dispatch.rs b/src/dispatch.rs index 9dd2e49..808aeba 100644 --- a/src/dispatch.rs +++ b/src/dispatch.rs @@ -14,14 +14,10 @@ pub async fn start(bot: &AutoSend) { dptree::filter(|msg: Message| msg.chat.is_group() || msg.chat.is_supergroup()) .endpoint(handlers::send::answer_common), ); - info!("Mesagisto-Bot启动成功"); + info!("Mesagisto信使启动成功"); Dispatcher::builder(bot.clone(), handler) - .default_handler(|upd| async move { - log::warn!("Unhandled update: {:?}", upd); - }) - // If the dispatcher fails for some reason, execute this handler. .error_handler(LoggingErrorHandler::with_custom_text( - "An error has occurred in the dispatcher", + "调度器中发生了一个错误", )) .build() .setup_ctrlc_handler() diff --git a/src/main.rs b/src/main.rs index c36cc0d..5b8d1c4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ use mesagisto_client::MesagistoConfig; use teloxide::{prelude2::*, Bot}; use bot::TG_BOT; -use config::CONFIG; +use crate::config::CONFIG; #[macro_use] extern crate educe; @@ -64,7 +64,7 @@ async fn run() -> Result<(), anyhow::Error> { .apply() .await; - log::info!("Mesagisto-Bot正在启动"); + log::info!("Mesagisto信使正在启动"); let bot = Bot::with_client(CONFIG.telegram.token.clone(), net::client_from_config()).auto_send(); @@ -72,6 +72,6 @@ async fn run() -> Result<(), anyhow::Error> { dispatch::start(&TG_BOT).await; CONFIG.save(); - log::info!("Mesagisto Bot is going to shut down"); + log::info!("Mesagisto信使即将关闭"); Ok(()) } diff --git a/src/message/handlers/send.rs b/src/message/handlers/send.rs index 93a5456..f4c1310 100644 --- a/src/message/handlers/send.rs +++ b/src/message/handlers/send.rs @@ -11,7 +11,7 @@ use mesagisto_client::server::SERVER; use mesagisto_client::EitherExt; use teloxide::prelude2::*; -pub async fn answer_common(msg: Message, bot: AutoSend) -> anyhow::Result<()> { +pub async fn answer_common(msg: Message, _bot: AutoSend) -> anyhow::Result<()> { let target = msg.chat_id(); if !CONFIG.target_address_mapper.contains_key(&target) { return Ok(());