Private
Public Access
1
0

bug fixes

This commit is contained in:
Sebastian Unterschütz
2025-11-26 18:56:59 +01:00
parent 6fdad68a9b
commit cf2e6e1c94
13 changed files with 392 additions and 144 deletions

35
utils.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import (
"log"
"strings"
)
func initBadWords() {
key := "config:badwords"
count, _ := rdb.SCard(ctx, key).Result()
if count == 0 {
log.Println("Lade Default Badwords...")
defaults := []string{"admin", "root", "hitler", "nazi", "sex", "fuck", "shit", "ass"}
for _, w := range defaults {
rdb.SAdd(ctx, key, w)
}
}
}
func containsBadWord(name string) bool {
badwords, _ := rdb.SMembers(ctx, "config:badwords").Result()
lowerName := strings.ToLower(name)
for _, word := range badwords {
if word == "" {
continue
}
if strings.Contains(lowerName, strings.ToLower(word)) {
return true
}
}
return false
}