2
0
mirror of https://gitee.com/hotlcc/wechat4j.git synced 2025-12-26 03:49:38 +08:00

提交代码

This commit is contained in:
hotlcc
2018-07-25 12:41:25 +08:00
parent 83e9411bcd
commit acc3fc9966
6 changed files with 399 additions and 91 deletions

View File

@@ -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();