Impl getMsgTypes

This commit is contained in:
Changhua 2023-03-19 10:21:02 +08:00
parent 468d6f2405
commit 80d9de2d15
2 changed files with 15 additions and 0 deletions

View File

@ -10,6 +10,8 @@ import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class Client {
private static final Logger logger = LoggerFactory.getLogger(Client.class);
@ -53,6 +55,18 @@ public class Client {
return "";
}
public Map<Integer, String> getMsgTypes() {
Request req = new Request.Builder().setFuncValue(Functions.FUNC_GET_MSG_TYPES_VALUE).build();
Response rsp = sendCmd(req);
Map<Integer, String> types = new HashMap<>();
if (rsp != null) {
return rsp.getTypes().getTypesMap();
}
return Wcf.MsgTypes.newBuilder().build().getTypesMap();
}
public void waitMs(int ms) {
try {
Thread.sleep(ms);

View File

@ -12,5 +12,6 @@ public class Main {
logger.info("isLogin: {}", client.isLogin());
logger.info("wxid: {}", client.getSelfWxid());
logger.info("message types: {}", client.getMsgTypes());
}
}