All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat(robot): 添加敏感词过滤和自动禁言功能 - 引入blazing/cool包用于敏感词检测 - 添加time包用于计算禁言时长 - 实现消息监听器对群聊中的敏感词进行检测 - 当检测到敏感词时自动禁言发送者10分钟 ```
55 lines
2.0 KiB
Go
55 lines
2.0 KiB
Go
package cmd
|
||
|
||
import (
|
||
"blazing/cool"
|
||
_ "blazing/modules/config/controller/robot"
|
||
_ "blazing/modules/player/controller/robot"
|
||
"time"
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/antiabuse" // 违禁词
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chatcount" // 聊天时长统计
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/airecord" // 群应用:AI声聊
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score"
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleepmanage" // 统计睡眠时间
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/atri" // ATRI词库
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/pig" // 来份猪猪
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/manager" // 群管
|
||
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aifalse" // 服务器监控
|
||
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/poker" // 抽扑克
|
||
|
||
//_ "github.com/FloatTech/zbputils/job" // 定时指令触发器
|
||
zero "github.com/wdvxdr1123/ZeroBot"
|
||
"github.com/wdvxdr1123/ZeroBot/driver"
|
||
)
|
||
|
||
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: "/",
|
||
SuperUsers: []int64{123456},
|
||
Driver: []zero.Driver{
|
||
// 正向 WS
|
||
driver.NewWebSocketClient("ws://43.248.3.21:3001", "ORQ5~lofO5VDwbG7"),
|
||
// 反向 WS
|
||
// driver.NewWebSocketServer(16, "ws://127.0.0.1:6701", ""),
|
||
// // HTTP
|
||
// driver.NewHTTPClient("http://127.0.0.1:6701", "", "http://127.0.0.1:6700", ""),
|
||
},
|
||
}, nil)
|
||
}
|