From 4736b19639030bd39f4e398c7b6f1039230a08c4 Mon Sep 17 00:00:00 2001 From: Yiwen-Chan Date: Mon, 5 Apr 2021 18:17:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E6=88=B3?= =?UTF-8?q?=E4=B8=80=E6=88=B3=E5=9B=9E=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat/chat.go | 24 ++++++++++++++++++++++++ main.go | 1 + 2 files changed, 25 insertions(+) create mode 100644 chat/chat.go diff --git a/chat/chat.go b/chat/chat.go new file mode 100644 index 00000000..952edb67 --- /dev/null +++ b/chat/chat.go @@ -0,0 +1,24 @@ +package chat + +import ( + "fmt" + "strconv" + "time" + + zero "github.com/wdvxdr1123/ZeroBot" +) + +func init() { // 插件主体 + zero.OnNotice(zero.OnlyToMe).SetBlock(true).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)) + } + }) +} diff --git a/main.go b/main.go index 30da56f0..3fca8b51 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/driver" + _ "github.com/Yiwen-Chan/ZeroBot-Plugin/chat" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/github" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/manager" _ "github.com/Yiwen-Chan/ZeroBot-Plugin/music"