Skip to content

Commit

Permalink
🔧 #152
Browse files Browse the repository at this point in the history
  • Loading branch information
adlered committed Oct 12, 2024
1 parent 0240d7c commit 0ee4f1c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ public void getChatRaw(final RequestContext context) {
JSONObject jsonObject = new JSONObject(content);
String msgType = jsonObject.optString("msgType");
if (!msgType.isEmpty()) {
dataModel.put("raw", "{\"msg\":\"想看红包金额,想得美 :)\",\"recivers\":\"[]\",\"senderId\":\"1380013800000\",\"msgType\":\"redPacket\",\"money\":14250,\"count\":250,\"type\":\"random\",\"got\":0,\"who\":[]}");
dataModel.put("raw", "{\"msg\":\"6\",\"recivers\":\"[]\",\"senderId\":\"1380013800000\",\"msgType\":\"redPacket\",\"money\":14250,\"count\":250,\"type\":\"random\",\"got\":0,\"who\":[]}");
return;
}
} catch (Exception ignored) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,15 @@ public static boolean record(final RequestContext context) {
// ==? 判定恶意发送非法红包 ?==
try {
JSONObject checkContent = new JSONObject(content);
if (checkContent.optString("msgType").equals("redPacket")) {
if (checkContent.optString("msgType").equals("redPacket") || checkContent.optString("msgType").equals("weather")) {
if (RECORD_POOL_2_IN_24H.access(userName)) {
sendBotMsg("监测到 @" + userName + " 伪造发送红包数据包,警告一次。");
sendBotMsg("监测到 @" + userName + " 伪造发送红包/天气数据包,警告一次。");
} else {
sendBotMsg("由于 @" + userName + " 第二次伪造发送红包数据包,现处以扣除积分 50 的处罚。");
abusePoint(userId, 50, "机器人罚单-聊天室伪造发送红包数据包");
sendBotMsg("由于 @" + userName + " 第二次伪造发送红包/天气数据包,现处以扣除积分 50 的处罚。");
abusePoint(userId, 50, "机器人罚单-聊天室伪造发送红包/天气数据包");
RECORD_POOL_2_IN_24H.remove(userName);
}
return false;
}
} catch (Exception ignored) {
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/js/chat-room.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,9 @@ ${result.info.msg}
let isPlusOne = Label.latestMessage === data.md;
try {
let msgJSON = $.parseJSON(data.content.replace("<p>", "").replace("</p>", ""));
if (msgJSON.msgType === "weather") {
isRedPacket = true;
}
if (msgJSON.msgType === "redPacket") {
isRedPacket = true;
let type = "未知类型红包";
Expand Down
Loading

0 comments on commit 0ee4f1c

Please sign in to comment.