40 lines
849 B
Go
Raw Normal View History

2018-11-21 12:05:20 +00:00
package main
import (
2019-05-08 23:09:08 +00:00
"fmt"
"io/ioutil"
"strings"
"unicode"
2018-11-21 12:05:20 +00:00
2019-04-23 05:45:17 +00:00
"github.com/akyoto/color"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2018-11-21 12:05:20 +00:00
)
func main() {
color.Yellow("Showing user intros")
defer color.Green("Finished.")
defer arn.Node.Close()
2019-05-08 23:09:08 +00:00
data, _ := ioutil.ReadFile("bad-words-list.txt")
fullText := string(data)
badWords := strings.Split(fullText, ",")
2018-11-21 12:05:20 +00:00
for user := range arn.StreamUsers() {
if user.Introduction == "" {
continue
}
2019-05-08 23:09:08 +00:00
for _, badWord := range badWords {
pos := strings.Index(user.Introduction, badWord)
if pos != -1 && (pos == 0 || !unicode.IsLetter(rune(user.Introduction[pos-1]))) && (pos+len(badWord) == len(user.Introduction) || !unicode.IsLetter(rune(user.Introduction[pos+len(badWord)]))) {
color.Cyan(user.Nick)
color.Red(badWord)
fmt.Println(user.Introduction)
break
}
2018-11-21 12:05:20 +00:00
}
}
}