Skip to content

Commit

Permalink
fix: messagefilter
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Feb 24, 2024
1 parent 244c6df commit ce89997
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main/kotlin/ltd/guimc/lgzbot/listener/message/MessageFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object MessageFilter {
if (textMessage.isEmpty() && e.message.content.isEmpty()) return

if (!(e.sender.permission.level < e.group.botPermission.level || ModuleStateConfig.slientmute)) return
if (textMessage.startsWith("/lgzbot") && e.sender.permitteeId.hasPermission(bypassMute)) return

allCheckedMessage++
if (!e.group.permitteeId.hasPermission(disableADCheck)) {
Expand Down Expand Up @@ -134,10 +135,18 @@ object MessageFilter {

if (!muted && textMessage.length >= stringLength) {
if (LL4JUtils.predict(textMessage)) {
val botOwner = e.bot.getFriend(Config.BotOwner)
requireNotNull(botOwner)
botOwner.sendMessage("发现一条模型认为违规的消息, 但正则匹配失败, 请检查.")
botOwner.sendMessage(e.message)

if (RegexUtils.matchRegexPinyin(adPinyinRegex, textMessage)) {
e.group.mute(e.sender, "非法发言内容 (模型预测, 强检查证实)")
riskList.add(e.sender)
setVl(e.sender.id, 99.0)
muted = true
} else {
val botOwner = e.bot.getFriend(Config.BotOwner)
requireNotNull(botOwner)
botOwner.sendMessage("发现一条模型认为违规的消息, 但正则匹配失败, 请检查.")
botOwner.sendMessage(e.message)
}
}
}
}
Expand Down

0 comments on commit ce89997

Please sign in to comment.