Skip to content

Commit

Permalink
🎨 改进代码样式 (#521)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Dec 10, 2022
1 parent 9550b81 commit 9a2081d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
10 changes: 4 additions & 6 deletions plugin/baiduaudit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func init() {
if !find {
msgs += "无"
}

} else {
// 生成配置文本
msgs = fmt.Sprintf("本群配置:\n"+
Expand Down Expand Up @@ -187,9 +186,9 @@ func init() {
group := getGroup(ctx.Event.GroupID)
inputType, _ := strconv.Atoi(k2)
if k1 == "不" {
group.WhiteListType[inputType] = true //不检测:则进入类型白名单
group.WhiteListType[inputType] = true // 不检测:则进入类型白名单
} else {
group.WhiteListType[inputType] = false //检测:则退出白名单
group.WhiteListType[inputType] = false // 检测:则退出白名单
}
config.Groups[ctx.Event.GroupID] = group
ctx.SendChain(message.At(ctx.Event.UserID), message.Text(fmt.Sprintf("本群将%s检测%s类型内容", k1, typetext[inputType])))
Expand Down Expand Up @@ -324,7 +323,6 @@ func init() {
}
group := getGroup(ctx.Event.GroupID)
ctx.SendChain(buildResp(bdres, group)...)

})
}

Expand Down Expand Up @@ -367,10 +365,10 @@ func banCheck(ctx *zero.Ctx, bdres baiduRes) {
} else {
bantime = group.BANTime * 60
}
//执行禁言
// 执行禁言
ctx.SetGroupBan(ctx.Event.GroupID, ctx.Event.UserID, bantime)
}
//查看是否开启撤回提示
// 查看是否开启撤回提示
if group.DMRemind {
res = append(res, message.At(ctx.Event.Sender.ID))
ctx.SendChain(res...)
Expand Down
2 changes: 1 addition & 1 deletion plugin/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func init() { // 插件主体
// 删除需要撤回的消息ID
ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1]))
// 删除请求撤回的消息ID
//ctx.DeleteMessage(message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64)))
// ctx.DeleteMessage(message.NewMessageIDFromInteger(ctx.Event.MessageID.(int64)))
})
// 群聊转发
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
Expand Down
3 changes: 1 addition & 2 deletions plugin/qqwife/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func init() {
err = 民政局.清理花名册("group" + strconv.FormatInt(ctx.Event.GroupID, 10))
default:
cmd := ctx.State["regex_matched"].([]string)[1]
gid, _ := strconv.ParseInt(cmd, 10, 64) //判断是否为群号
gid, _ := strconv.ParseInt(cmd, 10, 64) // 判断是否为群号
if gid == 0 {
ctx.SendChain(message.Text("请输入正确的群号"))
return
Expand Down Expand Up @@ -431,7 +431,6 @@ func (sql *婚姻登记) 清理花名册(gid ...string) error {
for _, listName := range grouplist {
if listName == "favorability" {
continue

}
err = sql.db.Drop(listName)
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/qqwife/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func init() {
var choicetext string
var ntrID = uid
var targetID = fiancee
var greenID int64 //被牛的
var greenID int64 // 被牛的
fianceeInfo, err := 民政局.查户口(gid, fiancee)
switch {
case err != nil:
Expand Down
8 changes: 4 additions & 4 deletions plugin/quan/quan.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package quan

import (
"fmt"
"strconv"

"github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"strconv"
)

const (
Expand All @@ -25,8 +26,8 @@ func init() { // 主函数
"- 权重查询+QQ号(可以不写,默认本人)",
})
en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
str := ctx.State["regex_matched"].([]string)[2] //获取uid
if str == "" { //user
str := ctx.State["regex_matched"].([]string)[2] // 获取uid
if str == "" { // user
str = strconv.FormatInt(ctx.Event.UserID, 10)
}
es, err := web.GetData(fmt.Sprintf(quan, str)) // 将网站返回结果赋值
Expand All @@ -36,5 +37,4 @@ func init() { // 主函数
}
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
})

}
7 changes: 4 additions & 3 deletions plugin/wenben/wenben.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ package wenben
import (
"encoding/json"
"fmt"
"strings"

"github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message"
"github.com/wdvxdr1123/ZeroBot/utils/helper"
"strings"
)

const (
tianqi = "https://xiaobai.klizi.cn/API/other/weather_1.php?data=&msg=%v" // api地址
pinyin = "http://ovooa.com/API/pinyin/api.php?type=text&msg=%v"
yiyan = "https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i" // 动漫 漫画 游戏 文学 影视 诗词
kouling = "http://ovooa.com/API/rao/api.php?type=text" //口令
kouling = "http://ovooa.com/API/rao/api.php?type=text" // 口令
tang = "http://api.btstu.cn/yan/api.php?charset=utf-8&encode=text"
qing = "https://xiaobai.klizi.cn/API/other/wtqh.php"
)
Expand Down Expand Up @@ -86,7 +87,7 @@ func init() { // 主函数
}
ctx.SendChain(message.Text(helper.BytesToString(data)))
})
en.OnFullMatch("每日一言").SetBlock(true).Handle(func(ctx *zero.Ctx) { //每日一言
en.OnFullMatch("每日一言").SetBlock(true).Handle(func(ctx *zero.Ctx) { // 每日一言
var rsp rspData
data, err := web.GetData(yiyan)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion plugin/ygo/ygocdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type searchResult struct {
func init() {
en := control.Register("ygocdb", &ctrl.Options[*zero.Ctx]{
DisableOnDefault: false,
Brief: "游戏王百鸽API",// 本插件基于游戏王百鸽API"https://www.ygo-sem.cn/"
Brief: "游戏王百鸽API", // 本插件基于游戏王百鸽API"https://www.ygo-sem.cn/"
Help: "- /ydp [xxx]\n" +
"- /yds [xxx]\n" +
"- /ydb [xxx]\n" +
Expand Down

0 comments on commit 9a2081d

Please sign in to comment.