From 79f1beac53981e06b68d9197e209a80d9f9ff6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 5 May 2024 02:09:25 +0900 Subject: [PATCH] =?UTF-8?q?fix(manager):=20=E6=92=A4=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- plugin/baiduaudit/model.go | 4 +--- plugin/manager/manager.go | 5 +++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 7f691e0f0d..4846051ded 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/tidwall/gjson v1.14.4 github.com/wcharczuk/go-chart/v2 v2.1.0 - github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504144809-0d0388f8f575 + github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915 gitlab.com/gomidi/midi/v2 v2.0.25 golang.org/x/image v0.3.0 golang.org/x/sys v0.19.0 diff --git a/go.sum b/go.sum index 683d29471f..f80f882a00 100644 --- a/go.sum +++ b/go.sum @@ -196,8 +196,8 @@ github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYm github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/wcharczuk/go-chart/v2 v2.1.0 h1:tY2slqVQ6bN+yHSnDYwZebLQFkphK4WNrVwnt7CJZ2I= github.com/wcharczuk/go-chart/v2 v2.1.0/go.mod h1:yx7MvAVNcP/kN9lKXM/NTce4au4DFN99j6i1OwDclNA= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504144809-0d0388f8f575 h1:98GpzXVAgqNCLF4B7MwmVLW08MDhfyx62Fz6aqCwO3M= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504144809-0d0388f8f575/go.mod h1:J6uHaXS/Am2VsLxF9TcU6il19PbOeC4SvgxHJ1E2jaE= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915 h1:mBbZc7WDwlLQfYK4lQvsZ5djTVu5YsEOwJaBBk5dDOw= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240504170749-c9c0e1fe4915/go.mod h1:J6uHaXS/Am2VsLxF9TcU6il19PbOeC4SvgxHJ1E2jaE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= diff --git a/plugin/baiduaudit/model.go b/plugin/baiduaudit/model.go index 34b97fc10a..e5dd8caf77 100644 --- a/plugin/baiduaudit/model.go +++ b/plugin/baiduaudit/model.go @@ -31,8 +31,6 @@ func (bdres *baiduRes) audit(ctx *zero.Ctx, configpath string) { if bdres.ConclusionType != 2 { return } - // 创建消息ID - mid := message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64)) // 获取群配置 group := config.groupof(ctx.Event.GroupID) // 检测群配置里的不检测类型白名单, 忽略掉不检测的违规类型 @@ -44,7 +42,7 @@ func (bdres *baiduRes) audit(ctx *zero.Ctx, configpath string) { // 生成回复文本 res := group.reply(bdres) // 撤回消息 - ctx.DeleteMessage(mid) + ctx.DeleteMessage(ctx.Event.MessageID) // 查看是否启用撤回后禁言 if group.DMBAN { // 从历史违规记录中获取指定用户 diff --git a/plugin/manager/manager.go b/plugin/manager/manager.go index 4e7b0952c2..cadb8a45ca 100644 --- a/plugin/manager/manager.go +++ b/plugin/manager/manager.go @@ -35,6 +35,7 @@ const ( "- 修改名片@QQ XXX\n" + "- 修改头衔@QQ XXX\n" + "- 申请头衔 XXX\n" + + "- 对信息回复: 撤回\n" + "- 踢出群聊@QQ\n" + "- 退出群聊 1234@bot\n" + "- 群聊转发 1234 XXX\n" + @@ -261,7 +262,7 @@ func init() { // 插件主体 engine.OnRegex(`^\[CQ:reply,id=(-?\d+)\].*撤回$`, zero.AdminPermission, zero.OnlyGroup).SetBlock(true). Handle(func(ctx *zero.Ctx) { // 删除需要撤回的消息ID - ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1])) + ctx.DeleteMessage(ctx.State["regex_matched"].([]string)[1]) }) // 群聊转发 engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true). @@ -658,7 +659,7 @@ func init() { // 插件主体 time.Unix(info.Get("operator_time").Int(), 0).Format("2006/01/02 15:04:05"), ))), ) - msgData := ctx.GetMessage(message.NewMessageIDFromInteger(info.Get("message_id").Int())).Elements + msgData := ctx.GetMessage(info.Get("message_id").Int()).Elements if msgData != nil { msg = append(msg, message.CustomNode(info.Get("sender_nick").String(), info.Get("sender_id").Int(), msgData),