antiabuse only to me (#393)

This commit is contained in:
AkiraXie 2022-08-30 14:21:57 +08:00 committed by GitHub
parent 486292434e
commit 664cb2f2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,9 @@ func deleteUser(gid, uid int64) error {
} }
func recoverUser() error { func recoverUser() error {
if !db.CanFind("banUser", "") {
return nil
}
obj := &banUser{} obj := &banUser{}
var uuids []string var uuids []string
err := db.FindFor("banUser", obj, "", func() error { err := db.FindFor("banUser", obj, "", func() error {
@ -60,6 +63,9 @@ func deleteWord(gid int64, word string) error {
} }
func recoverWord() error { func recoverWord() error {
if !db.CanFind("banWord", "") {
return nil
}
obj := &banWord{} obj := &banWord{}
var groupWords []string var groupWords []string
err := db.FindFor("banWord", obj, "", func() error { err := db.FindFor("banWord", obj, "", func() error {

View File

@ -10,6 +10,9 @@ import (
) )
func banRule(ctx *zero.Ctx) bool { func banRule(ctx *zero.Ctx) bool {
if !ctx.Event.IsToMe {
return false
}
gid := ctx.Event.GroupID gid := ctx.Event.GroupID
uid := ctx.Event.UserID uid := ctx.Event.UserID
uuid := fmt.Sprintf("%d-%d", gid, uid) uuid := fmt.Sprintf("%d-%d", gid, uid)