From e4a78e584244fbc59e0e6f51995c31fab06452db Mon Sep 17 00:00:00 2001 From: Yiwen-Chan Date: Wed, 7 Apr 2021 13:42:19 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E6=88=B3=E4=B8=80=E6=88=B3?= =?UTF-8?q?=E7=8B=AC=E7=AB=8B=E5=88=B0=E9=97=B2=E8=81=8A=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat/chat.go | 17 +++++------------ manager/manager.go | 10 ---------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/chat/chat.go b/chat/chat.go index 952edb67..b9820c6e 100644 --- a/chat/chat.go +++ b/chat/chat.go @@ -1,24 +1,17 @@ package chat import ( - "fmt" - "strconv" "time" zero "github.com/wdvxdr1123/ZeroBot" ) func init() { // 插件主体 - zero.OnNotice(zero.OnlyToMe).SetBlock(true).SetPriority(0). + // 戳一戳 + zero.On("notice/notify/poke", zero.OnlyToMe).SetBlock(false).SetPriority(0). Handle(func(ctx *zero.Ctx) { - if ctx.Event.NoticeType != "notify" { - return - } - bot, _ := strconv.ParseInt(zero.BotConfig.SelfID, 10, 64) - if ctx.Event.UserID == bot { - time.Sleep(time.Second * 1) - ctx.Send("请不要戳我 >_<") - ctx.Send(fmt.Sprintf("[CQ:poke,qq=%d]", ctx.Event.OperatorID)) - } + time.Sleep(time.Second * 1) + ctx.Send("请不要戳我 >_<") + return }) } diff --git a/manager/manager.go b/manager/manager.go index 43a9c642..7c6bda46 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -2,7 +2,6 @@ package manager import ( "strings" - "time" "github.com/Yiwen-Chan/ZeroBot-Plugin/manager/utils" zero "github.com/wdvxdr1123/ZeroBot" @@ -228,15 +227,6 @@ func init() { // 插件主体 ctx.Send("📧 --> " + ctx.State["regex_matched"].([]string)[1]) return }) - // 戳一戳 - zero.OnNotice().SetBlock(false).SetPriority(40). - Handle(func(ctx *zero.Ctx) { - if ctx.Event.NoticeType == "notify" && ctx.Event.SubType == "poke" && ctx.Event.RawEvent.Get("target_id").Int() == utils.Str2Int(zero.BotConfig.SelfID) { - time.Sleep(time.Second * 1) - ctx.Send("请不要戳我 >_<") - } - return - }) // 入群欢迎 zero.OnNotice().SetBlock(false).SetPriority(40). Handle(func(ctx *zero.Ctx) {