diff --git a/Cargo.lock b/Cargo.lock index 9c44947..e121766 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -659,7 +659,7 @@ dependencies = [ [[package]] name = "ica-rs" -version = "0.7.0" +version = "0.7.1" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index b86af18..207c514 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ica-rs" -version = "0.7.0" +version = "0.7.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/ica-rs/src/ica/events.rs b/ica-rs/src/ica/events.rs index 96f1a39..3f58140 100644 --- a/ica-rs/src/ica/events.rs +++ b/ica-rs/src/ica/events.rs @@ -9,7 +9,7 @@ use crate::data_struct::ica::all_rooms::Room; use crate::data_struct::ica::messages::{Message, MessageTrait, NewMessage}; use crate::data_struct::ica::online_data::OnlineData; use crate::ica::client::send_message; -use crate::{help_msg, py, version_str, MainStatus, VERSION}; +use crate::{client_id, help_msg, py, version_str, MainStatus, VERSION}; /// 获取在线数据 pub async fn get_online_data(payload: Payload, _client: Client) { @@ -57,7 +57,8 @@ pub async fn add_message(payload: Payload, client: Client) { if MainStatus::global_config().ica().admin_list.contains(&message.sender_id()) { // admin 区 // 先判定是否为 admin - if message.content().starts_with("/bot-enable") { + let client_id = client_id(); + if message.content().starts_with(&format!("/bot-enable-{}", client_id)) { // 尝试获取后面的信息 if let Some((_, name)) = message.content().split_once(" ") { let path_name = PathBuf::from(name); @@ -77,7 +78,7 @@ pub async fn add_message(payload: Payload, client: Client) { } } } - } else if message.content().starts_with("/bot-disable") { + } else if message.content().starts_with(&format!("/bot-disable-{}", client_id)) { if let Some((_, name)) = message.content().split_once(" ") { let path_name = PathBuf::from(name); match py::PyStatus::get_status(&path_name) { diff --git a/ica-rs/src/main.rs b/ica-rs/src/main.rs index 8d6bb13..15d4fcd 100644 --- a/ica-rs/src/main.rs +++ b/ica-rs/src/main.rs @@ -35,10 +35,10 @@ const HELP_MSG: &str = r#"/bot-rs 展示 python 侧信息(如果python插件启用了的话) /bot-ls 显示所有插件信息 -/bot-enable - 启用某个插件 -/bot-disable - 禁用某个插件 +/bot-enable- + 启用某个插件(具体到客户端) +/bot-disable- + 禁用某个插件(具体到客户端) by shenjackyuanjie"#; @@ -58,9 +58,10 @@ pub fn client_id() -> String { /// 获取版本信息 pub fn version_str() -> String { format!( - "shenbot-rs v{}-{} ica v{}({}) tailchat v{}", + "shenbot-rs v{}-{}-[{}] ica v{}({}) tailchat v{}", VERSION, if STABLE { "" } else { "开发版" }, + client_id(), ICA_VERSION, ica::ICA_PROTOCOL_VERSION, TAILCHAT_VERSION, diff --git a/ica-rs/src/py/class/ica.rs b/ica-rs/src/py/class/ica.rs index e57f3c5..da36ac7 100644 --- a/ica-rs/src/py/class/ica.rs +++ b/ica-rs/src/py/class/ica.rs @@ -218,6 +218,10 @@ impl IcaClientPy { #[getter] pub fn get_version(&self) -> String { crate::VERSION.to_string() } #[getter] + pub fn get_version_str(&self) -> String { crate::version_str() } + #[getter] + pub fn get_client_id(&self) -> String { crate::client_id() } + #[getter] pub fn get_ica_version(&self) -> String { crate::ICA_VERSION.to_string() } #[getter] pub fn get_startup_time(&self) -> SystemTime { crate::MainStatus::get_startup_time() } diff --git a/ica-rs/src/py/class/tailchat.rs b/ica-rs/src/py/class/tailchat.rs index 4b11675..c820d5e 100644 --- a/ica-rs/src/py/class/tailchat.rs +++ b/ica-rs/src/py/class/tailchat.rs @@ -65,6 +65,10 @@ impl TailchatClientPy { #[getter] pub fn get_version(&self) -> String { crate::VERSION.to_string() } #[getter] + pub fn get_version_str(&self) -> String { crate::version_str() } + #[getter] + pub fn get_client_id(&self) -> String { crate::client_id() } + #[getter] pub fn get_tailchat_version(&self) -> String { crate::TAILCHAT_VERSION.to_string() } #[getter] pub fn get_startup_time(&self) -> SystemTime { crate::MainStatus::get_startup_time() } diff --git a/ica-rs/src/tailchat/events.rs b/ica-rs/src/tailchat/events.rs index 1bb8a03..2334821 100644 --- a/ica-rs/src/tailchat/events.rs +++ b/ica-rs/src/tailchat/events.rs @@ -9,7 +9,7 @@ use tracing::{event, info, Level}; use crate::data_struct::tailchat::messages::ReceiveMessage; use crate::data_struct::tailchat::status::{BotStatus, UpdateDMConverse}; use crate::tailchat::client::{emit_join_room, send_message}; -use crate::{help_msg, py, MainStatus, TAILCHAT_VERSION, VERSION}; +use crate::{client_id, help_msg, py, MainStatus, TAILCHAT_VERSION, VERSION}; /// 所有 pub async fn any_event(event: Event, payload: Payload, _client: Client, _status: Arc) { @@ -79,14 +79,15 @@ pub async fn on_message(payload: Payload, client: Client, _status: Arc 我决定叫他 0.7.0 @@ -49,7 +56,6 @@ - `wrap_callback` 和 `wrap_any_callback` - 因为现在他俩已经进到 `rust_socketio` 里啦 - 添加了新的 macro - - `` - 支持了 `TailchatReceiveMessagePy` 的 `is_from_self` 方法 - 用于判断是否是自己发的消息