diff --git a/ica-rs/src/ica/client.rs b/ica-rs/src/ica/client.rs index 1b60dbb..8f30cfc 100644 --- a/ica-rs/src/ica/client.rs +++ b/ica-rs/src/ica/client.rs @@ -1,5 +1,5 @@ use crate::data_struct::ica::messages::{DeleteMessage, SendMessage}; -use crate::data_struct::ica::{RoomId, RoomIdTrait}; +use crate::data_struct::ica::{RoomId, RoomIdTrait, UserId}; use crate::error::{ClientResult, IcaError}; use crate::MainStatus; @@ -7,7 +7,7 @@ use colored::Colorize; use ed25519_dalek::{Signature, Signer, SigningKey}; use rust_socketio::asynchronous::Client; use rust_socketio::Payload; -use serde_json::Value; +use serde_json::{Value, json}; use tracing::{debug, event, span, warn, Level}; /// "安全" 的 发送一条消息 @@ -114,7 +114,8 @@ pub async fn send_room_sign_in(client: &Client, room_id: RoomId) -> bool { event!(Level::WARN, "不能向私聊发送签到信息"); return false; } - match client.emit("sendGroupSign", room_id).await { + let data = json!(room_id.abs()); + match client.emit("sendGroupSign", data).await { Ok(_) => { event!(Level::INFO, "已向群 {} 发送签到信息", room_id); true @@ -128,17 +129,10 @@ pub async fn send_room_sign_in(client: &Client, room_id: RoomId) -> bool { /// 向某个群/私聊的某个人发送戳一戳 pub async fn send_poke(client: &Client, room_id: RoomId, target: UserId) -> bool { + let data = json!([room_id, target]); match client.emit( - "sendGroupPoke", - (room_id, { - if room_id.is_chat() { - room_id - // 以防你 target 写错了 - } else { - target - } - }), - ) { + "sendGroupPoke", data + ).await { Ok(_) => { event!(Level::INFO, "已向 {} 的 {} 发送戳一戳", room_id, target); true diff --git a/ica-rs/src/py/class/ica.rs b/ica-rs/src/py/class/ica.rs index b3acc93..c256ccb 100644 --- a/ica-rs/src/py/class/ica.rs +++ b/ica-rs/src/py/class/ica.rs @@ -8,7 +8,7 @@ use tracing::{event, Level}; use crate::data_struct::ica::messages::{ DeleteMessage, MessageTrait, NewMessage, ReplyMessage, SendMessage, }; -use crate::data_struct::ica::{MessageId, RoomId, RoomIdTrait}; +use crate::data_struct::ica::{MessageId, RoomId, RoomIdTrait, UserId}; use crate::ica::client::{delete_message, send_message, send_poke, send_room_sign_in}; use crate::MainStatus; diff --git a/news.md b/news.md index 05c566e..7d43f5f 100644 --- a/news.md +++ b/news.md @@ -15,6 +15,7 @@ - 用于发送戳一戳 - 可以指定群的某个人 - 或者指定好友 + - 目前还是有点问题 - socketio event: `sendGroupPoke` ## 0.7.4 diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 07ade69..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..31578d3 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" \ No newline at end of file