From 1eba64bf9ec0b014c976c1a56c4bfb17caca62fe Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sun, 12 May 2024 18:54:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=9F=E8=A7=89=E8=BF=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 3 ++- ica-rs/Cargo.toml | 13 ++++++++++--- ica-rs/src/ica/events.rs | 14 ++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f71a835..93e3db3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -653,9 +653,10 @@ dependencies = [ [[package]] name = "ica-rs" -version = "0.6.0-dev" +version = "0.6.1" dependencies = [ "anyhow", + "base64 0.22.1", "chrono", "colored", "ed25519", diff --git a/ica-rs/Cargo.toml b/ica-rs/Cargo.toml index d9caa12..98f22ab 100644 --- a/ica-rs/Cargo.toml +++ b/ica-rs/Cargo.toml @@ -1,24 +1,31 @@ [package] name = "ica-rs" -version = "0.6.0-dev" +version = "0.6.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] default = ["ica", "tailchat"] -ica = ["dep:ed25519", "dep:ed25519-dalek", "dep:hex", "dep:rust_socketio"] +ica = [ + "dep:ed25519", + "dep:ed25519-dalek", + "dep:hex", + "dep:rust_socketio", + "dep:base64", +] tailchat = ["dep:rust_socketio", "dep:md-5", "dep:reqwest"] [dependencies] # ica +base64 = { version = "0.22", optional = true } ed25519 = { version = "2.2", optional = true } ed25519-dalek = { version = "2.1", optional = true } hex = { version = "0.4", optional = true } # tailchat -reqwest = { version = "0.12.2", optional = true } +reqwest = { version = "0.12.4", optional = true } md-5 = { version = "0.10.6", optional = true } # ica & tailchat (socketio) diff --git a/ica-rs/src/ica/events.rs b/ica-rs/src/ica/events.rs index 3b6a8ca..51b34a0 100644 --- a/ica-rs/src/ica/events.rs +++ b/ica-rs/src/ica/events.rs @@ -33,12 +33,14 @@ pub async fn add_message(payload: Payload, client: Client) { info!("add_message {}", message.to_string().cyan()); // 就在这里处理掉最基本的消息 // 之后的处理交给插件 - if message.content().eq("/bot-rs") && !message.is_from_self() && !message.is_reply() { - let reply = message.reply_with(&format!( - "shenbot v{}\nica-async-rs pong v{}", - VERSION, ICA_VERSION - )); - send_message(&client, &reply).await; + if !message.is_from_self() && !message.is_reply() { + if message.content() == "/bot-rs" { + let reply = message.reply_with(&format!( + "shenbot v{}\nica-async-rs pong v{}", + VERSION, ICA_VERSION + )); + send_message(&client, &reply).await; + } } // python 插件 py::call::ica_new_message_py(&message, &client).await;