mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
🎨 改进代码样式 (#521)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
9550b817c5
commit
9a2081de0a
@ -157,7 +157,6 @@ func init() {
|
|||||||
if !find {
|
if !find {
|
||||||
msgs += "无"
|
msgs += "无"
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 生成配置文本
|
// 生成配置文本
|
||||||
msgs = fmt.Sprintf("本群配置:\n"+
|
msgs = fmt.Sprintf("本群配置:\n"+
|
||||||
@ -187,9 +186,9 @@ func init() {
|
|||||||
group := getGroup(ctx.Event.GroupID)
|
group := getGroup(ctx.Event.GroupID)
|
||||||
inputType, _ := strconv.Atoi(k2)
|
inputType, _ := strconv.Atoi(k2)
|
||||||
if k1 == "不" {
|
if k1 == "不" {
|
||||||
group.WhiteListType[inputType] = true //不检测:则进入类型白名单
|
group.WhiteListType[inputType] = true // 不检测:则进入类型白名单
|
||||||
} else {
|
} else {
|
||||||
group.WhiteListType[inputType] = false //检测:则退出白名单
|
group.WhiteListType[inputType] = false // 检测:则退出白名单
|
||||||
}
|
}
|
||||||
config.Groups[ctx.Event.GroupID] = group
|
config.Groups[ctx.Event.GroupID] = group
|
||||||
ctx.SendChain(message.At(ctx.Event.UserID), message.Text(fmt.Sprintf("本群将%s检测%s类型内容", k1, typetext[inputType])))
|
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)
|
group := getGroup(ctx.Event.GroupID)
|
||||||
ctx.SendChain(buildResp(bdres, group)...)
|
ctx.SendChain(buildResp(bdres, group)...)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,10 +365,10 @@ func banCheck(ctx *zero.Ctx, bdres baiduRes) {
|
|||||||
} else {
|
} else {
|
||||||
bantime = group.BANTime * 60
|
bantime = group.BANTime * 60
|
||||||
}
|
}
|
||||||
//执行禁言
|
// 执行禁言
|
||||||
ctx.SetGroupBan(ctx.Event.GroupID, ctx.Event.UserID, bantime)
|
ctx.SetGroupBan(ctx.Event.GroupID, ctx.Event.UserID, bantime)
|
||||||
}
|
}
|
||||||
//查看是否开启撤回提示
|
// 查看是否开启撤回提示
|
||||||
if group.DMRemind {
|
if group.DMRemind {
|
||||||
res = append(res, message.At(ctx.Event.Sender.ID))
|
res = append(res, message.At(ctx.Event.Sender.ID))
|
||||||
ctx.SendChain(res...)
|
ctx.SendChain(res...)
|
||||||
|
|||||||
@ -271,7 +271,7 @@ func init() { // 插件主体
|
|||||||
// 删除需要撤回的消息ID
|
// 删除需要撤回的消息ID
|
||||||
ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1]))
|
ctx.DeleteMessage(message.NewMessageIDFromString(ctx.State["regex_matched"].([]string)[1]))
|
||||||
// 删除请求撤回的消息ID
|
// 删除请求撤回的消息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).
|
engine.OnRegex(`^群聊转发.*?(\d+)\s(.*)`, zero.SuperUserPermission).SetBlock(true).
|
||||||
|
|||||||
@ -282,7 +282,7 @@ func init() {
|
|||||||
err = 民政局.清理花名册("group" + strconv.FormatInt(ctx.Event.GroupID, 10))
|
err = 民政局.清理花名册("group" + strconv.FormatInt(ctx.Event.GroupID, 10))
|
||||||
default:
|
default:
|
||||||
cmd := ctx.State["regex_matched"].([]string)[1]
|
cmd := ctx.State["regex_matched"].([]string)[1]
|
||||||
gid, _ := strconv.ParseInt(cmd, 10, 64) //判断是否为群号
|
gid, _ := strconv.ParseInt(cmd, 10, 64) // 判断是否为群号
|
||||||
if gid == 0 {
|
if gid == 0 {
|
||||||
ctx.SendChain(message.Text("请输入正确的群号"))
|
ctx.SendChain(message.Text("请输入正确的群号"))
|
||||||
return
|
return
|
||||||
@ -431,7 +431,6 @@ func (sql *婚姻登记) 清理花名册(gid ...string) error {
|
|||||||
for _, listName := range grouplist {
|
for _, listName := range grouplist {
|
||||||
if listName == "favorability" {
|
if listName == "favorability" {
|
||||||
continue
|
continue
|
||||||
|
|
||||||
}
|
}
|
||||||
err = sql.db.Drop(listName)
|
err = sql.db.Drop(listName)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,7 +193,7 @@ func init() {
|
|||||||
var choicetext string
|
var choicetext string
|
||||||
var ntrID = uid
|
var ntrID = uid
|
||||||
var targetID = fiancee
|
var targetID = fiancee
|
||||||
var greenID int64 //被牛的
|
var greenID int64 // 被牛的
|
||||||
fianceeInfo, err := 民政局.查户口(gid, fiancee)
|
fianceeInfo, err := 民政局.查户口(gid, fiancee)
|
||||||
switch {
|
switch {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
|||||||
@ -3,13 +3,14 @@ package quan
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/FloatTech/floatbox/web"
|
"github.com/FloatTech/floatbox/web"
|
||||||
ctrl "github.com/FloatTech/zbpctrl"
|
ctrl "github.com/FloatTech/zbpctrl"
|
||||||
"github.com/FloatTech/zbputils/control"
|
"github.com/FloatTech/zbputils/control"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -25,8 +26,8 @@ func init() { // 主函数
|
|||||||
"- 权重查询+QQ号(可以不写,默认本人)",
|
"- 权重查询+QQ号(可以不写,默认本人)",
|
||||||
})
|
})
|
||||||
en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
en.OnRegex(`^权重查询\s*(\[CQ:at,qq=)?(\d+)?`).SetBlock(true).Handle(func(ctx *zero.Ctx) {
|
||||||
str := ctx.State["regex_matched"].([]string)[2] //获取uid
|
str := ctx.State["regex_matched"].([]string)[2] // 获取uid
|
||||||
if str == "" { //user
|
if str == "" { // user
|
||||||
str = strconv.FormatInt(ctx.Event.UserID, 10)
|
str = strconv.FormatInt(ctx.Event.UserID, 10)
|
||||||
}
|
}
|
||||||
es, err := web.GetData(fmt.Sprintf(quan, str)) // 将网站返回结果赋值
|
es, err := web.GetData(fmt.Sprintf(quan, str)) // 将网站返回结果赋值
|
||||||
@ -36,5 +37,4 @@ func init() { // 主函数
|
|||||||
}
|
}
|
||||||
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
|
ctx.SendChain(message.Text(str, helper.BytesToString(es))) // 输出结果
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,20 +4,21 @@ package wenben
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/FloatTech/floatbox/web"
|
"github.com/FloatTech/floatbox/web"
|
||||||
ctrl "github.com/FloatTech/zbpctrl"
|
ctrl "github.com/FloatTech/zbpctrl"
|
||||||
"github.com/FloatTech/zbputils/control"
|
"github.com/FloatTech/zbputils/control"
|
||||||
zero "github.com/wdvxdr1123/ZeroBot"
|
zero "github.com/wdvxdr1123/ZeroBot"
|
||||||
"github.com/wdvxdr1123/ZeroBot/message"
|
"github.com/wdvxdr1123/ZeroBot/message"
|
||||||
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
"github.com/wdvxdr1123/ZeroBot/utils/helper"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
tianqi = "https://xiaobai.klizi.cn/API/other/weather_1.php?data=&msg=%v" // api地址
|
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"
|
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" // 动漫 漫画 游戏 文学 影视 诗词
|
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"
|
tang = "http://api.btstu.cn/yan/api.php?charset=utf-8&encode=text"
|
||||||
qing = "https://xiaobai.klizi.cn/API/other/wtqh.php"
|
qing = "https://xiaobai.klizi.cn/API/other/wtqh.php"
|
||||||
)
|
)
|
||||||
@ -86,7 +87,7 @@ func init() { // 主函数
|
|||||||
}
|
}
|
||||||
ctx.SendChain(message.Text(helper.BytesToString(data)))
|
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
|
var rsp rspData
|
||||||
data, err := web.GetData(yiyan)
|
data, err := web.GetData(yiyan)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ type searchResult struct {
|
|||||||
func init() {
|
func init() {
|
||||||
en := control.Register("ygocdb", &ctrl.Options[*zero.Ctx]{
|
en := control.Register("ygocdb", &ctrl.Options[*zero.Ctx]{
|
||||||
DisableOnDefault: false,
|
DisableOnDefault: false,
|
||||||
Brief: "游戏王百鸽API",// 本插件基于游戏王百鸽API"https://www.ygo-sem.cn/"
|
Brief: "游戏王百鸽API", // 本插件基于游戏王百鸽API"https://www.ygo-sem.cn/"
|
||||||
Help: "- /ydp [xxx]\n" +
|
Help: "- /ydp [xxx]\n" +
|
||||||
"- /yds [xxx]\n" +
|
"- /yds [xxx]\n" +
|
||||||
"- /ydb [xxx]\n" +
|
"- /ydb [xxx]\n" +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user