mirror of
https://gitee.com/hotlcc/wechat4j.git
synced 2025-12-26 03:49:38 +08:00
提交代码
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import com.hotlcc.wechat4j.Wechat;
|
||||
import com.hotlcc.wechat4j.api.WebWeixinApi;
|
||||
import com.hotlcc.wechat4j.handler.ReceivedMsgHandler;
|
||||
import com.hotlcc.wechat4j.model.ReceivedMsg;
|
||||
import com.hotlcc.wechat4j.model.UserInfo;
|
||||
import com.hotlcc.wechat4j.util.CommonUtil;
|
||||
|
||||
public class TestClass2 {
|
||||
@@ -7,6 +10,15 @@ public class TestClass2 {
|
||||
WebWeixinApi api = new WebWeixinApi();
|
||||
Wechat wechat = new Wechat();
|
||||
wechat.setWebWeixinApi(api);
|
||||
wechat.addReceivedMsgHandler(new ReceivedMsgHandler() {
|
||||
@Override
|
||||
public void handleAllType(Wechat wechat, ReceivedMsg msg) {
|
||||
System.out.println("===收到消息:" + msg.getContent());
|
||||
UserInfo contact = wechat.getContactByUserName(false, msg.getFromUserName());
|
||||
if ("李国栋".equals(contact.getRemarkName())) {
|
||||
}
|
||||
}
|
||||
});
|
||||
wechat.autoLogin();
|
||||
CommonUtil.threadSleep(1000 * 60 * 10);
|
||||
wechat.logout();
|
||||
|
||||
Reference in New Issue
Block a user