🎨 戳一戳独立到闲聊插件

This commit is contained in:
Yiwen-Chan
2021-04-07 13:42:19 +08:00
parent d3888d22b1
commit e4a78e5842
2 changed files with 5 additions and 22 deletions

View File

@@ -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
})
}