From 63e18e8eabcccb974dfd948c4ef8e1e3c6bfafe4 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 25 Feb 2024 01:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0bmcl=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=92=8C=E5=9C=A8=E7=BA=BF=E6=95=B0=E6=8D=AE=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ica-rs/plugins/bmcl.py | 2 +- ica-rs/src/data_struct/online_data.rs | 5 +---- ica-rs/src/main.rs | 5 ++--- ica-rs/src/py/mod.rs | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ica-rs/plugins/bmcl.py b/ica-rs/plugins/bmcl.py index 594fc8b..7771f66 100644 --- a/ica-rs/plugins/bmcl.py +++ b/ica-rs/plugins/bmcl.py @@ -69,7 +69,7 @@ def wrap_request(url: str, msg: NewMessage, client: IcaClient) -> Optional[dict] def bmcl_dashboard(msg: NewMessage, client: IcaClient) -> None: req_time = time.time() # 记录请求时间 - data = wrap_request("https://bd.bangbang93.com/openbmclapi/metric/dashboard", client) + data = wrap_request("https://bd.bangbang93.com/openbmclapi/metric/dashboard", msg, client) if data is None: return data_bytes: float = data["bytes"] diff --git a/ica-rs/src/data_struct/online_data.rs b/ica-rs/src/data_struct/online_data.rs index 69f8744..8f9ef62 100644 --- a/ica-rs/src/data_struct/online_data.rs +++ b/ica-rs/src/data_struct/online_data.rs @@ -197,10 +197,7 @@ mod tests { assert_eq!(online_data.online, true); assert_eq!(online_data.qqid, 123456); assert_eq!(online_data.icalingua_info.ica_version, "2.11.1"); - assert_eq!( - online_data.icalingua_info.os_info, - "Linux c038fad79f13 4.4.302+" - ); + assert_eq!(online_data.icalingua_info.os_info, "Linux c038fad79f13 4.4.302+"); assert_eq!(online_data.icalingua_info.resident_set_size, "95.43MB"); assert_eq!(online_data.icalingua_info.heap_used, "37.31MB"); assert_eq!(online_data.icalingua_info.load, "4.23 2.15 1.59"); diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 141c639..ef2037d 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -35,9 +35,7 @@ macro_rules! wrap_any_callback { #[tokio::main] async fn main() { - tracing_subscriber::fmt() - .with_max_level(tracing::Level::DEBUG) - .init(); + tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init(); info!("ica-async-rs v{}", VERSION); // 从命令行获取 host 和 key @@ -59,6 +57,7 @@ async fn main() { .on("messageFailed", wrap_callback!(events::failed_message)) .on("onlineData", wrap_callback!(events::get_online_data)) .on("setAllRooms", wrap_callback!(events::update_all_room)) + .on("setMessages", wrap_callback!(events::set_messages)) .on("addMessage", wrap_callback!(events::add_message)) .on("deleteMessage", wrap_callback!(events::delete_message)) .connect() diff --git a/ica-rs/src/py/mod.rs b/ica-rs/src/py/mod.rs index 23e01b5..049b797 100644 --- a/ica-rs/src/py/mod.rs +++ b/ica-rs/src/py/mod.rs @@ -1,5 +1,5 @@ -pub mod class; pub mod call; +pub mod class; use std::time::SystemTime; use std::{collections::HashMap, path::PathBuf};