mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 12:41:05 +08:00
更新bmcl插件和在线数据模块
This commit is contained in:
parent
16ff8f534e
commit
63e18e8eab
|
@ -69,7 +69,7 @@ def wrap_request(url: str, msg: NewMessage, client: IcaClient) -> Optional[dict]
|
||||||
def bmcl_dashboard(msg: NewMessage, client: IcaClient) -> None:
|
def bmcl_dashboard(msg: NewMessage, client: IcaClient) -> None:
|
||||||
req_time = time.time()
|
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:
|
if data is None:
|
||||||
return
|
return
|
||||||
data_bytes: float = data["bytes"]
|
data_bytes: float = data["bytes"]
|
||||||
|
|
|
@ -197,10 +197,7 @@ mod tests {
|
||||||
assert_eq!(online_data.online, true);
|
assert_eq!(online_data.online, true);
|
||||||
assert_eq!(online_data.qqid, 123456);
|
assert_eq!(online_data.qqid, 123456);
|
||||||
assert_eq!(online_data.icalingua_info.ica_version, "2.11.1");
|
assert_eq!(online_data.icalingua_info.ica_version, "2.11.1");
|
||||||
assert_eq!(
|
assert_eq!(online_data.icalingua_info.os_info, "Linux c038fad79f13 4.4.302+");
|
||||||
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.resident_set_size, "95.43MB");
|
||||||
assert_eq!(online_data.icalingua_info.heap_used, "37.31MB");
|
assert_eq!(online_data.icalingua_info.heap_used, "37.31MB");
|
||||||
assert_eq!(online_data.icalingua_info.load, "4.23 2.15 1.59");
|
assert_eq!(online_data.icalingua_info.load, "4.23 2.15 1.59");
|
||||||
|
|
|
@ -35,9 +35,7 @@ macro_rules! wrap_any_callback {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init();
|
||||||
.with_max_level(tracing::Level::DEBUG)
|
|
||||||
.init();
|
|
||||||
info!("ica-async-rs v{}", VERSION);
|
info!("ica-async-rs v{}", VERSION);
|
||||||
|
|
||||||
// 从命令行获取 host 和 key
|
// 从命令行获取 host 和 key
|
||||||
|
@ -59,6 +57,7 @@ async fn main() {
|
||||||
.on("messageFailed", wrap_callback!(events::failed_message))
|
.on("messageFailed", wrap_callback!(events::failed_message))
|
||||||
.on("onlineData", wrap_callback!(events::get_online_data))
|
.on("onlineData", wrap_callback!(events::get_online_data))
|
||||||
.on("setAllRooms", wrap_callback!(events::update_all_room))
|
.on("setAllRooms", wrap_callback!(events::update_all_room))
|
||||||
|
.on("setMessages", wrap_callback!(events::set_messages))
|
||||||
.on("addMessage", wrap_callback!(events::add_message))
|
.on("addMessage", wrap_callback!(events::add_message))
|
||||||
.on("deleteMessage", wrap_callback!(events::delete_message))
|
.on("deleteMessage", wrap_callback!(events::delete_message))
|
||||||
.connect()
|
.connect()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
pub mod class;
|
|
||||||
pub mod call;
|
pub mod call;
|
||||||
|
pub mod class;
|
||||||
|
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use std::{collections::HashMap, path::PathBuf};
|
use std::{collections::HashMap, path::PathBuf};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user