diff --git a/pom.xml b/pom.xml
index 9faeb0b..3baf1ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.hotlcc
wechat4j
- 0.1.1
+ 0.1.2
wechat4j
Wechat client for Java.
diff --git a/src/main/java/com/hotlcc/wechat4j/Wechat.java b/src/main/java/com/hotlcc/wechat4j/Wechat.java
index d03860c..95ed37b 100644
--- a/src/main/java/com/hotlcc/wechat4j/Wechat.java
+++ b/src/main/java/com/hotlcc/wechat4j/Wechat.java
@@ -1178,6 +1178,39 @@ public class Wechat {
return sendText(content, userName);
}
+ /**
+ * 发送文本消息(根据多种名称)
+ *
+ * @param content
+ * @param userName
+ * @param nickName
+ * @param remarkName
+ * @return
+ */
+ public JSONObject sendText(String content, String userName, String nickName, String remarkName) {
+ UserInfo userInfo = null;
+
+ if (StringUtil.isNotEmpty(userName)) {
+ return sendText(content, userName);
+ } else if (StringUtil.isNotEmpty(nickName)) {
+ userInfo = getContactByNickName(false, nickName);
+ } else if (StringUtil.isNotEmpty(remarkName)) {
+ userInfo = getContactByRemarkName(false, remarkName);
+ } else {
+ String loginUserName = getLoginUserName(false);
+ return sendText(content, loginUserName);
+ }
+
+ if (userInfo == null) {
+ return null;
+ }
+ userName = userInfo.getUserName();
+ if (StringUtil.isEmpty(userName)) {
+ return null;
+ }
+ return sendText(content, userName);
+ }
+
//TODO 待完成
@Deprecated
public JSONObject sendImage(File image, String userName) {