mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-21 23:50:09 +08:00
添加ban人记忆
This commit is contained in:
parent
ef9f764fa0
commit
f5d2bd78b9
@ -35,17 +35,19 @@ func newantidb(path string) (*antidb, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
_ = db.Del("__bantime__", "WHERE time<="+strconv.FormatInt(time.Now().Add(-time.Hour*banhour).Unix(), 10))
|
_ = db.FindFor("__bantime__", nilbt, "", func() error {
|
||||||
return db, db.FindFor("__bantime__", nilbt, "", func() error {
|
|
||||||
t := time.Unix(nilbt.Time, 0)
|
t := time.Unix(nilbt.Time, 0)
|
||||||
ttl := time.Until(t.Add(time.Hour * banhour)) // second
|
ttl := time.Until(t.Add(time.Hour * banhour)) // second
|
||||||
if ttl < time.Minute {
|
if ttl < time.Minute {
|
||||||
|
_ = managers.DoUnblock(nilbt.ID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
cache.Set(nilbt.ID, struct{}{})
|
cache.Set(nilbt.ID, struct{}{})
|
||||||
cache.Touch(nilbt.ID, -time.Since(t))
|
cache.Touch(nilbt.ID, -time.Since(t))
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
_ = db.Del("__bantime__", "WHERE time<="+strconv.FormatInt(time.Now().Add(time.Minute-time.Hour*banhour).Unix(), 10))
|
||||||
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *antidb) isInAntiList(uid, gid int64, msg string) bool {
|
func (db *antidb) isInAntiList(uid, gid int64, msg string) bool {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user