I am building a bot that parses tinder for key words. Currently doing a test which should filter out specific names. For test purposes it is supposed to match rather than pass, hence 'true' rather than 'false'.
"Ex" is an array of names declared in a JSON file called "filter.json".
The issue is that I get a "nothing matched" notification on names declared in the array, which it should match.
type Filter struct {
Ex []string
}
func containsAny(text []string, keys []string) (string, bool) {
for _, part := range text {
for _, key := range keys {
if strings.Contains(strings.ToLower(part), strings.ToLower(key)) {
return key, true
}
}
}
return "", false
}
func match(rec tinder.Recommendation) (string, bool) {
if name, ok := containsAny([]string{rec.Name}, filter.Ex); ok {
return fmt.Sprintf("ex name: %s", name), true
}
}