- 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
19 lines
508 B
Go
19 lines
508 B
Go
package kikifilter
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// Функция, проверяющая что запрещенные слова отсутсвуют в текста
|
|
// Возвращает true если слова есть в тексте, возвращает false если их нет
|
|
func IsWordsInText(text string, words []string) bool {
|
|
fmt.Println(words)
|
|
for _, v := range words {
|
|
if strings.Contains(text, v) {
|
|
fmt.Println(strings.Contains(text, v))
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|