```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(robot): 添加敏感词过滤和自动禁言功能

- 引入blazing/cool包用于敏感词检测
- 添加time包用于计算禁言时长
- 实现消息监听器对群聊中的敏感词进行检测
- 当检测到敏感词时自动禁言发送者10分钟
```
This commit is contained in:
昔念
2026-03-25 11:34:30 +08:00
parent d995a63ff9
commit 12c97dbf90

View File

@@ -1,8 +1,10 @@
package cmd
import (
"blazing/cool"
_ "blazing/modules/config/controller/robot"
_ "blazing/modules/player/controller/robot"
"time"
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/antiabuse" // 违禁词
@@ -30,7 +32,12 @@ import (
)
func startrobot() {
zero.OnMessage(func(ctx *zero.Ctx) bool {
return cool.Filter.IsSensitive(ctx.Event.Message.String()) && ctx.Event.GroupID != 0
}).Handle(func(ctx *zero.Ctx) {
ctx.SetGroupBan(ctx.Event.GroupID, ctx.Event.Sender.ID, int64(10*time.Minute))
})
zero.RunAndBlock(&zero.Config{
NickName: []string{"bot"},
CommandPrefix: "/",