From 3c835ab1214092866602c5bf955c1e44864f142c Mon Sep 17 00:00:00 2001 From: super_wang Date: Mon, 10 Jul 2023 23:07:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B8=A2=E5=87=BA=E7=BE=A4?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rust/wcferry/src/wechat.rs | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/rust/wcferry/src/wechat.rs b/rust/wcferry/src/wechat.rs index ce0421c..ad2ce89 100644 --- a/rust/wcferry/src/wechat.rs +++ b/rust/wcferry/src/wechat.rs @@ -702,6 +702,35 @@ pub fn add_chatroom_members( }; } +pub fn del_chatroom_members( + roomid: String, + wxids: String, + wechat: &mut WeChat, +) -> Result> { + let req = wcf::Request { + func: wcf::Functions::FuncDelRoomMembers.into(), + msg: Some(wcf::request::Msg::M(wcf::AddMembers { roomid, wxids })), + }; + let response = match send_cmd(wechat, req) { + Ok(res) => res, + Err(e) => { + error!("命令发送失败: {}", e); + return Err("微信群踢人失败".into()); + } + }; + if response.is_none() { + return Ok(false); + } + match response.unwrap() { + wcf::response::Msg::Status(status) => { + return Ok(status == 1); + } + _ => { + return Ok(false); + } + }; +} + pub fn decrypt_image( src: String, dst: String, @@ -864,6 +893,18 @@ mod test { println!("Status: {}", status); } + #[test] + fn test_del_chatroom_members() { + let mut wechat = crate::wechat::WeChat::default(); + let status = crate::wechat::del_chatroom_members( + String::from("34476879773@chatroom"), + String::from("*******"), + &mut wechat, + ) + .unwrap(); + println!("Status: {}", status); + } + #[test] fn test_get_user_info() { let mut wechat = crate::wechat::WeChat::default();