Skip to content

Commit

Permalink
🎨 改进代码样式
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 5, 2021
1 parent 2f90283 commit 8233950
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package main

import (
"fmt"
Expand Down
4 changes: 1 addition & 3 deletions plugin_atri/atri.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("嗯呜呜……夏生先生……?"))
Expand All @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions plugin_qingyunke/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -20,10 +21,8 @@ func init() {
for _, v := range result.Array() {
Daily(v.Get("group_id").Int())
}

})


}

func morningData(groupId int64) {
Expand Down
1 change: 1 addition & 0 deletions plugin_qingyunke/picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 4 additions & 12 deletions plugin_qingyunke/qingyunke.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ 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"
"regexp"
"strconv"
"strings"
"time"

zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/extension/rate"
"github.com/wdvxdr1123/ZeroBot/message"
)

var prio = -1
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand All @@ -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 {
Expand Down
17 changes: 8 additions & 9 deletions plugin_qingyunke/request.go
Original file line number Diff line number Diff line change
@@ -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~")
}
})


}

0 comments on commit 8233950

Please sign in to comment.