Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
🐛 do not handle their own outgoing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hellokaton committed Jan 21, 2018
1 parent b4047b7 commit 03cb5d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/io/github/biezhi/wechat/api/WeChatApiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,10 @@ public List<WeChatMessage> handleMsg(List<Message> messages) {
List<WeChatMessage> weChatMessages = new ArrayList<>(messages.size());
log.info("你有新的消息");
for (Message message : messages) {
weChatMessages.add(this.processMsg(message));
WeChatMessage weChatMessage = this.processMsg(message);
if (null != weChatMessage) {
weChatMessages.add(weChatMessage);
}
}
return weChatMessages;
}
Expand All @@ -661,6 +664,11 @@ private WeChatMessage processMsg(Message message) {
String msgId = message.getId();
String content = message.getContent();

// 不处理自己发的消息
if (message.getFromUserName().equals(bot.session().getUserName())) {
return null;
}

if (message.isGroup()) {
// 如果本地缓存的群名列表没有当前群,则添加进去,下次更新使用
if (message.getFromUserName().contains(GROUP_IDENTIFY) &&
Expand Down

0 comments on commit 03cb5d4

Please sign in to comment.