diff --git a/main.go b/main.go index 6ef2ec25..a09ffb6c 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -package main +package main import ( "fmt" diff --git a/plugin_atri/atri.go b/plugin_atri/atri.go index bfe1f5de..fb553ccb 100644 --- a/plugin_atri/atri.go +++ b/plugin_atri/atri.go @@ -25,7 +25,6 @@ var ( func init() { // 插件主体 zero.OnFullMatch("ATRI醒醒", zero.AdminPermission).SetBlock(true).SetPriority(prio). Handle(func(ctx *zero.Ctx) { - enable = true time.Sleep(time.Second * 1) ctx.SendChain(randText("嗯呜呜……夏生先生……?")) @@ -50,7 +49,6 @@ func init() { // 插件主体 Handle(func(ctx *zero.Ctx) { time.Sleep(time.Second * 1) ctx.SendChain(randImage("SUKI.jpg", "SUKI1.jpg", "SUKI2.png")) - }) zero.OnKeywordGroup([]string{"草你妈", "操你妈", "脑瘫", "废柴", "fw", "five", "废物", "战斗", "爬", "爪巴", "sb", "SB", "傻B"}, atriSwitch(), atriSleep(), zero.OnlyToMe).SetBlock(true).SetPriority(prio - 1). Handle(func(ctx *zero.Ctx) { @@ -113,7 +111,7 @@ func init() { // 插件主体 )) } }) - zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好","晚上好"}, atriSwitch()).SetBlock(true).SetPriority(prio). + zero.OnFullMatchGroup([]string{"晚安", "oyasuminasai", "おやすみなさい", "晚好", "晚上好"}, atriSwitch()).SetBlock(true).SetPriority(prio). Handle(func(ctx *zero.Ctx) { now := time.Now().Hour() switch { diff --git a/plugin_qingyunke/cron.go b/plugin_qingyunke/cron.go index 0ed0c4b6..f8b1da76 100644 --- a/plugin_qingyunke/cron.go +++ b/plugin_qingyunke/cron.go @@ -2,13 +2,14 @@ package qingyunke //定时早安,晚安 import ( - "github.com/robfig/cron" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" "log" "math/rand" "strconv" "time" + + "github.com/robfig/cron" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" ) func init() { @@ -20,10 +21,8 @@ func init() { for _, v := range result.Array() { Daily(v.Get("group_id").Int()) } - }) - } func morningData(groupId int64) { diff --git a/plugin_qingyunke/picture.go b/plugin_qingyunke/picture.go index 94ca378b..90f8446a 100644 --- a/plugin_qingyunke/picture.go +++ b/plugin_qingyunke/picture.go @@ -12,6 +12,7 @@ import ( var ( reImg = `https?://[^"]+?(\.((jpg)|(png)|(jpeg)|(gif)|(bmp)))` ) + //取图片 func getPicture() string { prefix := "https://fabiaoqing.com/tag/detail/id/5682/page" diff --git a/plugin_qingyunke/qingyunke.go b/plugin_qingyunke/qingyunke.go index 2967aa37..2201f9de 100644 --- a/plugin_qingyunke/qingyunke.go +++ b/plugin_qingyunke/qingyunke.go @@ -3,9 +3,6 @@ package qingyunke import ( "encoding/json" "fmt" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/extension/rate" - "github.com/wdvxdr1123/ZeroBot/message" "io/ioutil" "math/rand" "net/http" @@ -13,6 +10,10 @@ import ( "strconv" "strings" "time" + + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/extension/rate" + "github.com/wdvxdr1123/ZeroBot/message" ) var prio = -1 @@ -41,13 +42,11 @@ func init() { // 插件主体 } textReply = strings.Replace(textReply, "菲菲", "椛椛", -1) if ctx.Event.DetailType == "group" { - if faceReply != -1 { ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply), message.Face(faceReply)) } else { ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text(textReply)) } - } if ctx.Event.DetailType == "private" { if faceReply != -1 { @@ -60,7 +59,6 @@ func init() { // 插件主体 default: //频繁触发,不回复 } - }) zero.OnRegex("CQ:image,file=|CQ:face,id=", zero.OnlyToMe, atriSwitch()).SetBlock(false).FirstPriority(). Handle(func(ctx *zero.Ctx) { @@ -72,26 +70,20 @@ func init() { // 插件主体 if ctx.Event.DetailType == "private" { ctx.SendChain(message.Image(imageUrl)) } - }) zero.OnFullMatch("开启自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio). Handle(func(ctx *zero.Ctx) { - enable = true ctx.SendChain(message.Text("自动回复开启")) - }) zero.OnFullMatch("关闭自动回复", zero.SuperUserPermission).SetBlock(true).SetPriority(prio). Handle(func(ctx *zero.Ctx) { - enable = false ctx.SendChain(message.Text("自动回复关闭")) - }) // 群空调 - } type QYData struct { diff --git a/plugin_qingyunke/request.go b/plugin_qingyunke/request.go index b1a08835..ac08d699 100644 --- a/plugin_qingyunke/request.go +++ b/plugin_qingyunke/request.go @@ -1,22 +1,21 @@ package qingyunke -import ( + +import ( zero "github.com/wdvxdr1123/ZeroBot" - "log" - ) + //自动同意加群,加好友 -func init() { +func init() { zero.OnRequest().SetBlock(false).FirstPriority().Handle(func(ctx *zero.Ctx) { - if ctx.Event.RequestType == "friend"{ + if ctx.Event.RequestType == "friend" { log.Println("加好友") - ctx.SetFriendAddRequest(ctx.Event.Flag,true,"") + ctx.SetFriendAddRequest(ctx.Event.Flag, true, "") } - if ctx.Event.RequestType == "group" && ctx.Event.SubType == "invite"{ + if ctx.Event.RequestType == "group" && ctx.Event.SubType == "invite" { log.Println("加群") - ctx.SetGroupAddRequest(ctx.Event.Flag,"invite",true,"我爱你,mua~") + ctx.SetGroupAddRequest(ctx.Event.Flag, "invite", true, "我爱你,mua~") } }) - }