Skip to content

Commit

Permalink
优化禁言策略
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyodi committed Aug 11, 2022
1 parent 6068fa2 commit e03b306
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions src/main/java/com/badeling/msbot/serviceImpl/MsgServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,25 @@ public ReplyMsg receive(String msg) {
}
}

//禁言信息
List<MsgNoPrefix> result = msgNoPrefixRepository.findMsgNPList();
for(MsgNoPrefix m : result) {
if(m.isExact()&&receiveMsg.getRaw_message().contains(m.getQuestion())) {
System.out.println(m.getAnswer());
if (m.getQuestion().contains("md") && receiveMsg.getRaw_message().contains("md5")){
break;
}
else if (m.getAnswer().equals("禁言")){
ReplyMsg replyMsg = new ReplyMsg();
replyMsg.setAt_sender(true);
replyMsg.setAuto_escape(false);
replyMsg.setBan(true);
replyMsg.setReply("[CQ:image,file=save/AB59F6053D317B67646AA3B363B87415]");
System.out.println(replyMsg);
return replyMsg;
}
}
}

if (receiveMsg.getRaw_message().startsWith(MsbotConst.botName)) {
System.out.println(receiveMsg.toString());
Expand Down Expand Up @@ -347,29 +366,9 @@ else if (receiveMsg.getRaw_message().length() >= 4 && receiveMsg.getRaw_message(
// handMemberSellAndBuy(receiveMsg);
// }

//禁言信息
List<MsgNoPrefix> result = msgNoPrefixRepository.findMsgNPList();
for(MsgNoPrefix m : result) {
if(m.isExact()&&receiveMsg.getRaw_message().contains(m.getQuestion())) {
System.out.println(m.getAnswer());
if (m.getQuestion().contains("md") && receiveMsg.getRaw_message().contains("md5")){
break;
}
else if (m.getAnswer().equals("禁言")){
ReplyMsg replyMsg = new ReplyMsg();
replyMsg.setAt_sender(true);
replyMsg.setAuto_escape(false);
replyMsg.setBan(true);
replyMsg.setReply("[CQ:image,file=save/AB59F6053D317B67646AA3B363B87415]");
System.out.println(replyMsg);
return replyMsg;
}
else{
handReplyMsg(receiveMsg);
}
}
}
//re-read
handReplyMsg(receiveMsg);

//re-read
receiveMsg.setRaw_message(receiveMsg.getMessage());
return handRereadMsg(receiveMsg);

Expand Down

0 comments on commit e03b306

Please sign in to comment.