🎨 改进代码样式 (#521)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2022-12-10 14:29:55 +08:00 committed by GitHub
parent 9550b817c5
commit 9a2081de0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 18 deletions

View File

@ -157,7 +157,6 @@ func init() {
if !find {
msgs += "无"
}
} else {
// 生成配置文本
msgs = fmt.Sprintf("本群配置:\n"+
@ -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])))
@ -324,7 +323,6 @@ func init() {
}
group := getGroup(ctx.Event.GroupID)
ctx.SendChain(buildResp(bdres, group)...)
})
}
@ -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...)

View File

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

View File

@ -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
@ -431,7 +431,6 @@ func (sql *婚姻登记) 清理花名册(gid ...string) error {
for _, listName := range grouplist {
if listName == "favorability" {
continue
}
err = sql.db.Drop(listName)
}

View File

@ -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:

View File

@ -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 (
@ -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)) // 将网站返回结果赋值
@ -36,5 +37,4 @@ func init() { // 主函数
}
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
})
}

View File

@ -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"
)
@ -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 {

View File

@ -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" +