就喜欢花哨的

This commit is contained in:
shenjack-5600u 2025-04-08 00:18:19 +08:00
parent 1711270c9f
commit 3435b8c0fb
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F
3 changed files with 11 additions and 9 deletions

View File

@ -101,12 +101,12 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe
}
}
// 等待停止信号
event!(Level::INFO, "ica client waiting for stop signal");
event!(Level::INFO, "{}", "ica client waiting for stop signal".purple());
stop_reciver.await.ok();
event!(Level::INFO, "socketio client stopping");
event!(Level::INFO, "{}", "socketio client stopping".yellow());
match socket.disconnect().await {
Ok(_) => {
event!(Level::INFO, "socketio client stopped");
event!(Level::INFO, "{}", "socketio client stopped".green());
Ok(())
}
Err(e) => {
@ -114,7 +114,7 @@ pub async fn start_ica(config: &IcaConfig, stop_reciver: StopGetter) -> ClientRe
match e {
rust_socketio::Error::IncompleteResponseFromEngineIo(inner_e) => {
if inner_e.to_string().contains("AlreadyClosed") {
event!(Level::INFO, "socketio client stopped");
event!(Level::INFO, "{}", "socketio client stopped".green());
Ok(())
} else {
event!(Level::ERROR, "socketio 客户端出现了 Error: {:?}", inner_e);

View File

@ -16,6 +16,7 @@ mod ica;
#[cfg(feature = "tailchat")]
mod tailchat;
use colored::Colorize;
use config::BotConfig;
use error::PyPluginError;
use tracing::{event, span, Level};
@ -167,7 +168,7 @@ fn main() -> anyhow::Result<()> {
}
async fn inner_main() -> anyhow::Result<()> {
let span = span!(Level::INFO, "Shenbot Main");
let span = span!(Level::INFO, "bot-main");
let _enter = span.enter();
event!(Level::INFO, "shenbot-rs v{} starting", VERSION);
@ -184,28 +185,28 @@ async fn inner_main() -> anyhow::Result<()> {
}
// 准备一个用于停止 socket 的变量
event!(Level::INFO, "启动 ICA");
let (ica_send, ica_recv) = tokio::sync::oneshot::channel::<()>();
if bot_config.check_ica() {
event!(Level::INFO, "{}", "开始启动 ICA".green());
let config = bot_config.ica();
tokio::spawn(async move {
ica::start_ica(&config, ica_recv).await.unwrap();
});
} else {
event!(Level::INFO, "未启用 ica");
event!(Level::INFO, "{}", "ica 未启用, 不管他".cyan());
}
let (tailchat_send, tailchat_recv) = tokio::sync::oneshot::channel::<()>();
if bot_config.check_tailchat() {
event!(Level::INFO, "启动 Tailchat");
event!(Level::INFO, "{}", "开始启动 tailchat".green());
let config = bot_config.tailchat();
tokio::spawn(async move {
tailchat::start_tailchat(config, tailchat_recv).await.unwrap();
});
} else {
event!(Level::INFO, "未启用 Tailchat");
event!(Level::INFO, "{}", "tailchat 未启用, 不管他".bright_magenta());
}
tokio::time::sleep(Duration::from_secs(1)).await;

View File

@ -5,6 +5,7 @@
- 修复了 Python 插件停不下来就真的停不下来的问题
- 让初始化的时候 插件启/禁状态显示更明显了
- 有颜色啦!
- 加了不少颜色
### ica 2.0.1