修复了只要发消息违禁次数就会增加的bug

This commit is contained in:
95478 2024-06-27 14:18:45 +08:00
parent ba1ee68a1c
commit 6b55ac4da0
4 changed files with 28 additions and 33 deletions

Binary file not shown.

View File

@ -1,42 +1,38 @@
[
{
"host": "111.30.182.254",
"host": "111.30.169.83",
"port": 443
},
{
"host": "36.155.187.225",
"port": 8080
},
{
"host": "msfwifi.3g.qq.com",
"port": 8080
},
{
"host": "39.156.126.178",
"host": "111.30.182.254",
"port": 443
},
{
"host": "39.156.140.102",
"host": "36.155.207.230",
"port": 443
},
{
"host": "111.31.206.48",
"port": 80
},
{
"host": "36.155.205.230",
"host": "120.232.31.239",
"port": 8080
},
{
"host": "36.155.245.16",
"port": 80
},
{
"host": "120.233.17.147",
"port": 8080
},
{
"host": "120.232.27.24",
"host": "120.241.130.195",
"port": 14000
},
{
"host": "36.155.163.25",
"port": 80
},
{
"host": "39.156.126.178",
"port": 80
},
{
"host": "36.155.163.117",
"port": 8080
}
]

View File

@ -25,28 +25,27 @@ public class RecallMessageListener extends MessageListener {
super(List.of("原神", "OP"), true);//自定义违禁词
}
public void recall(GroupMessageEvent event) throws InterruptedException {//当有人发违禁词自动撤回并禁言一分钟
public int recall(GroupMessageEvent event, int groupInvalidCount, Map<Long, Integer> groupMemberInvalidedCountList, List<Long> groupInvalidMember) throws InterruptedException {//当有人发违禁词自动撤回并禁言一分钟
String message = event.getMessage().contentToString();
if (this.invalidText(message)) {
event.getSender().mute(60);//禁言60秒
Thread.sleep(500);//半秒后撤回方便演示
this.recallMessage(event.getMessage());
groupInvalidCount++;
invalidMember.invalidCountList(groupMemberInvalidedCountList, event);
invalidMember.invalidMemberList(groupInvalidMember, groupMemberInvalidedCountList, event);
return groupInvalidCount;
}
return groupInvalidCount;
}
@RobotListenerHandler(contactId = 518909220)//监控增加群聊1
public void recallGroup1Message(GroupMessageEvent event) throws InterruptedException {
recall(event);
group1InvalidCount++;
invalidMember.invalidCountList(group1MemberInvalidedCountList, event);
invalidMember.invalidMemberList(group1InvalidMember, group1MemberInvalidedCountList, event);
group1InvalidCount = recall(event, group1InvalidCount, group1MemberInvalidedCountList, group1InvalidMember);
}
@RobotListenerHandler(contactId = 1033597003)//监控增加群聊2
public void recallGroup2Message(GroupMessageEvent event) throws InterruptedException {
recall(event);
group2InvalidCount++;
invalidMember.invalidCountList(group2MemberInvalidedCountList, event);
invalidMember.invalidMemberList(group2InvalidMember, group2MemberInvalidedCountList, event);
group2InvalidCount = recall(event, group2InvalidCount, group2MemberInvalidedCountList, group2InvalidMember);
}
}

View File

@ -6,8 +6,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class QqBotApplication {
public static void main(String[] args) {
SpringApplication.run(QqBotApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(QqBotApplication.class, args);
}
}