Feed generator written in Golang
1package main
2
3import "strings"
4
5type MessageFilter = func(rawText string) bool
6
7func MessageIsAboutCoffee(rawText string) bool {
8 textLower := strings.ToLower(rawText)
9 thisIsAboutCoffee := strings.Contains(textLower, "coffee") || strings.Contains(textLower, "コーヒー")
10 return thisIsAboutCoffee
11}
12
13func MessageSlippedOnBananaPeel(rawText string) bool {
14 textLower := strings.ToLower(rawText)
15 thisIsAboutCoffee := (strings.Contains(textLower, "banana") ||
16 strings.Contains(textLower, "peel"))
17 return thisIsAboutCoffee
18}