(s, sub1 string, sub2 ...string)
| 969 | } |
| 970 | |
| 971 | func minDistance(s, sub1 string, sub2 ...string) int { |
| 972 | if !strings.Contains(s, sub1) { |
| 973 | return 0 |
| 974 | } |
| 975 | |
| 976 | min := math.MaxInt16 |
| 977 | for i := range sub2 { |
| 978 | d, e := distance(s, sub1, sub2[i]) |
| 979 | if e && d < min && d > 0 { |
| 980 | min = d |
| 981 | } |
| 982 | } |
| 983 | if min == math.MaxInt16 { |
| 984 | min = 0 |
| 985 | } |
| 986 | return min |
| 987 | } |
| 988 | |
| 989 | func (r *auddBot) Comment(p *models.Comment) { |
| 990 | //fmt.Print("c") // why? to test the amount of new comments on Reddit! |