feat: add content filtering functionality
- Introduce kikifilter package with IsWordsInText() function for word filtering - Add FiltredWorlds configuration option to KikiSettings - Integrate filtering into service to prevent posting filtered content - Update Dockerfile and Makefile to include filter package - Add example configuration with filtered words
This commit is contained in:
parent
95c95031d8
commit
3b0b688843
7 changed files with 32 additions and 14 deletions
|
|
@ -1,12 +1,17 @@
|
|||
package filter
|
||||
package kikifilter
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Функция, проверяющая что запрещенные слова отсутсвуют в текста
|
||||
// Возвращает true если слова есть в тексте, возвращает false если их нет
|
||||
func isWordsInText(text string, words []string) bool {
|
||||
func IsWordsInText(text string, words []string) bool {
|
||||
fmt.Println(words)
|
||||
for _, v := range words {
|
||||
if strings.ContainsAny(text, v) {
|
||||
if strings.Contains(text, v) {
|
||||
fmt.Println(strings.Contains(text, v))
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue