mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 02:00:24 +00:00
✏️ make lint happy
This commit is contained in:
@@ -33,7 +33,7 @@ func checkNewUser(qq, gid int64, ghun, hash string) (bool, string) {
|
||||
// 600s 内验证成功
|
||||
ok := math.Abs(int(time.Now().Unix()-st)) < 600
|
||||
if ok {
|
||||
_ = db.Insert("member", &Member{QQ: qq, Ghun: ghun})
|
||||
_ = db.Insert("member", &member{QQ: qq, Ghun: ghun})
|
||||
return true, ""
|
||||
}
|
||||
return false, "时间戳超时"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package manager
|
||||
|
||||
type Welcome struct {
|
||||
type welcome struct {
|
||||
GrpID int64 `db:"gid"`
|
||||
Msg string `db:"msg"`
|
||||
}
|
||||
|
||||
type Member struct {
|
||||
type member struct {
|
||||
QQ int64 `db:"qq"`
|
||||
// github username
|
||||
Ghun string `db:"ghun"`
|
||||
|
||||
@@ -66,8 +66,14 @@ func init() { // 插件主体
|
||||
go func() {
|
||||
process.SleepAbout1sTo2s()
|
||||
clock = timer.NewClock(db)
|
||||
db.Create("welcome", &Welcome{})
|
||||
db.Create("member", &Member{})
|
||||
err := db.Create("welcome", &welcome{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = db.Create("member", &member{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
// 升为管理
|
||||
engine.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40).
|
||||
@@ -362,7 +368,7 @@ func init() { // 插件主体
|
||||
engine.OnNotice().SetBlock(false).FirstPriority().
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
if ctx.Event.NoticeType == "group_increase" && ctx.Event.SelfID != ctx.Event.UserID {
|
||||
var w Welcome
|
||||
var w welcome
|
||||
err := db.Find("welcome", &w, "where gid = "+strconv.FormatInt(ctx.Event.GroupID, 10))
|
||||
if err == nil {
|
||||
ctx.SendChain(message.Text(w.Msg))
|
||||
@@ -422,7 +428,7 @@ func init() { // 插件主体
|
||||
// 设置欢迎语
|
||||
engine.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40).
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
w := &Welcome{
|
||||
w := &welcome{
|
||||
GrpID: ctx.Event.GroupID,
|
||||
Msg: ctx.State["regex_matched"].([]string)[1],
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user