增加网页监控功能

This commit is contained in:
95478 2024-06-25 00:13:43 +08:00
parent 420ccb8988
commit 28f2b4c54a
8 changed files with 88 additions and 45 deletions

Binary file not shown.

View File

@ -1,6 +1,26 @@
[ [
{ {
"host": "49.7.253.58", "host": "111.30.169.83",
"port": 14000
},
{
"host": "39.156.126.247",
"port": 80
},
{
"host": "39.156.126.247",
"port": 443
},
{
"host": "36.155.163.25",
"port": 443
},
{
"host": "36.155.187.225",
"port": 8080
},
{
"host": "111.30.169.83",
"port": 443 "port": 443
}, },
{ {
@ -8,35 +28,15 @@
"port": 8080 "port": 8080
}, },
{ {
"host": "49.7.253.65", "host": "120.232.65.165",
"port": 80
},
{
"host": "183.2.144.33",
"port": 14000 "port": 14000
}, },
{ {
"host": "183.47.102.193", "host": "36.155.163.51",
"port": 8080
},
{
"host": "117.62.242.155",
"port": 80 "port": 80
}, },
{ {
"host": "121.229.94.199", "host": "120.241.130.195",
"port": 8080
},
{
"host": "222.94.109.78",
"port": 8080
},
{
"host": "49.7.253.177",
"port": 443
},
{
"host": "42.81.192.158",
"port": 8080 "port": 8080
} }
] ]

Binary file not shown.

View File

@ -0,0 +1,23 @@
package com.mtz.qqbot.Controller;
import com.mtz.qqbot.Listener.HandleMessageListener;
import com.mtz.qqbot.Listener.RecallMessageListener;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class listController {
@GetMapping("/messagelist")
public String list() {
return "今日好友消息:[" + HandleMessageListener.friendMessageCount + "]条<br>" +
"今日群聊1消息[" + HandleMessageListener.group1MessageCount + "]条<br>" +
"今日群聊2消息[" + HandleMessageListener.group2MessageCount + "]条<br>" +
"今日收到的群聊临时会话消息:[" + HandleMessageListener.groupTempMessageCount + "]条<br><br>" +
"今日群聊1违禁消息[" + RecallMessageListener.group1InvalidCount + "]条<br>" +
"今日群聊2违禁消息[" + RecallMessageListener.group2InvalidCount + "]条<br>" +
"今日群聊1违禁超过5次QQ号名单:" + RecallMessageListener.group1InvalidMember + "<br>" +
"今日群聊2违禁超过5次QQ号名单" + RecallMessageListener.group2InvalidMember;
}
}

View File

@ -1,18 +0,0 @@
package com.mtz.qqbot.Controller;
import com.mtz.qqbot.Listener.HandleMessageListener;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class testController {
@GetMapping("/messagelist")
public String hello() {
return "今日好友消息:[" + HandleMessageListener.friendMessageCount + "]条\n" +
"今日群聊1消息[" + HandleMessageListener.group1MessageCount + "]条\n" +
"今日群聊2消息[" + HandleMessageListener.group2MessageCount + "]条\n" +
"今日收到的群聊临时会话消息:[" + HandleMessageListener.groupTempMessageCount + "]条\n";
}
}

View File

@ -13,6 +13,8 @@ public class HandleMessageListener {
public static int group2MessageCount = 0; public static int group2MessageCount = 0;
public static int groupTempMessageCount = 0; public static int groupTempMessageCount = 0;
@RobotListenerHandler//接收来自好友的消息打印到控制台 @RobotListenerHandler//接收来自好友的消息打印到控制台
public void handleFriendMessage(FriendMessageEvent event) { public void handleFriendMessage(FriendMessageEvent event) {
String message = event.getMessage().contentToString(); String message = event.getMessage().contentToString();

View File

@ -1,16 +1,26 @@
package com.mtz.qqbot.Listener; package com.mtz.qqbot.Listener;
import com.mtz.qqbot.Tool.invalidMember;
import net.itbaima.robot.event.RobotListener; import net.itbaima.robot.event.RobotListener;
import net.itbaima.robot.event.RobotListenerHandler; import net.itbaima.robot.event.RobotListenerHandler;
import net.itbaima.robot.listener.MessageListener; import net.itbaima.robot.listener.MessageListener;
import net.mamoe.mirai.event.events.GroupMessageEvent; import net.mamoe.mirai.event.events.GroupMessageEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@RobotListener @RobotListener
public class RecallMessageListener extends MessageListener { public class RecallMessageListener extends MessageListener {
public static int group1InvalidCount = 0; public static int group1InvalidCount = 0;
public static int group2InvalidCount = 0; public static int group2InvalidCount = 0;
public Map<Long, Integer> group1MemberInvalidedCountList = new HashMap<Long, Integer>();
public static List<Long> group1InvalidMember = new ArrayList<Long>();
public Map<Long, Integer> group2MemberInvalidedCountList = new HashMap<Long, Integer>();
public static List<Long> group2InvalidMember = new ArrayList<Long>();
public RecallMessageListener() { public RecallMessageListener() {
super(List.of("原神", "OP"), true);//自定义违禁词 super(List.of("原神", "OP"), true);//自定义违禁词
} }
@ -18,10 +28,9 @@ public class RecallMessageListener extends MessageListener {
public void recall(GroupMessageEvent event) throws InterruptedException {//当有人发违禁词自动撤回并禁言一分钟 public void recall(GroupMessageEvent event) throws InterruptedException {//当有人发违禁词自动撤回并禁言一分钟
String message = event.getMessage().contentToString(); String message = event.getMessage().contentToString();
if (this.invalidText(message)) { if (this.invalidText(message)) {
event.getSender().mute(60); // event.getSender().mute(60);
Thread.sleep(500);//防止操作太快被腾讯封禁 // Thread.sleep(500);//半秒后撤回方便演示
this.recallMessage(event.getMessage()); this.recallMessage(event.getMessage());
} }
} }
@ -29,11 +38,15 @@ public class RecallMessageListener extends MessageListener {
public void recallGroup1Message(GroupMessageEvent event) throws InterruptedException { public void recallGroup1Message(GroupMessageEvent event) throws InterruptedException {
recall(event); recall(event);
group1InvalidCount++; group1InvalidCount++;
invalidMember.invalidCountList(group1MemberInvalidedCountList, event);
invalidMember.invalidMemberList(group1InvalidMember, group1MemberInvalidedCountList, event);
} }
@RobotListenerHandler(contactId = 1033597003)//监控增加群聊2 @RobotListenerHandler(contactId = 1033597003)//监控增加群聊2
public void recallGroup2Message(GroupMessageEvent event) throws InterruptedException { public void recallGroup2Message(GroupMessageEvent event) throws InterruptedException {
recall(event); recall(event);
group2InvalidCount++; group2InvalidCount++;
invalidMember.invalidCountList(group2MemberInvalidedCountList, event);
invalidMember.invalidMemberList(group2InvalidMember, group2MemberInvalidedCountList, event);
} }
} }

View File

@ -0,0 +1,23 @@
package com.mtz.qqbot.Tool;
import net.mamoe.mirai.event.events.GroupMessageEvent;
import java.util.List;
import java.util.Map;
public class invalidMember {
public static void invalidCountList(Map<Long, Integer> groupMemberInvalidedCountList, GroupMessageEvent event) {
if (groupMemberInvalidedCountList.get(event.getSender().getId()) == null) {
groupMemberInvalidedCountList.put(event.getSender().getId(), 1);//初始化
} else {
int invalidCount = Integer.parseInt(String.valueOf(groupMemberInvalidedCountList.get(event.getSender().getId()))) + 1;
groupMemberInvalidedCountList.put(event.getSender().getId(), invalidCount);
}
}
public static void invalidMemberList(List<Long> groupInvalidMember, Map<Long, Integer> groupMemberInvalidedCountList, GroupMessageEvent event) {
if (groupMemberInvalidedCountList.get(event.getSender().getId()).equals(5)) {
groupInvalidMember.add(event.getSender().getId());
}
}
}