diff --git a/README.md b/README.md index 81122e24..44bbef12 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,6 @@ docker attach notify.moe * Make some changes and upload them to your fork. * Create a pull request on this repository (with the diffs of your fork). -### Bookmark - -Create a bookmark in your browser and set this code as the URL: - -```js -javascript:(() => )(); -``` - -Clicking this bookmark will let you switch between `notify.moe` (live) and `beta.notify.moe` (development). - ## Find us * [Discord](https://discord.gg/0kimAmMCeXGXuzNF) diff --git a/README.src.md b/README.src.md index 256a776f..2eef9f30 100644 --- a/README.src.md +++ b/README.src.md @@ -73,19 +73,6 @@ docker attach notify.moe * Make some changes and upload them to your fork. * Create a pull request on this repository (with the diffs of your fork). -### Bookmark - -Create a bookmark in your browser and set this code as the URL: - -```js -javascript:(() => { - location = location.href.indexOf('://beta.') === -1 ? - location.href.replace('://', '://beta.') : location.href.replace('://beta.', '://'); -})(); -``` - -Clicking this bookmark will let you switch between `notify.moe` (live) and `beta.notify.moe` (development). - ## Find us * [Discord](https://discord.gg/0kimAmMCeXGXuzNF) diff --git a/docs/bookmarks.md b/docs/bookmarks.md new file mode 100644 index 00000000..19f90d5a --- /dev/null +++ b/docs/bookmarks.md @@ -0,0 +1,14 @@ +# Bookmarks + +## Live/Dev switcher + +Create a bookmark in your browser and set this code as the URL: + +```js +javascript:(() => { + location = location.href.indexOf('://beta.') === -1 ? + location.href.replace('://', '://beta.') : location.href.replace('://beta.', '://'); +})(); +``` + +Clicking this bookmark will let you switch between `notify.moe` (live) and `beta.notify.moe` (development). \ No newline at end of file diff --git a/patches/user-show-intros/user-show-intros.go b/patches/user-show-intros/user-show-intros.go index 86e2028f..7b675d15 100644 --- a/patches/user-show-intros/user-show-intros.go +++ b/patches/user-show-intros/user-show-intros.go @@ -1,28 +1,39 @@ package main import ( - "regexp" + "fmt" + "io/ioutil" + "strings" + "unicode" "github.com/akyoto/color" "github.com/animenotifier/arn" ) -var flaggedWords = regexp.MustCompile("fuck|fucking|freaking|shit|bad|terrible|awful|wtf") - func main() { color.Yellow("Showing user intros") defer color.Green("Finished.") defer arn.Node.Close() + data, _ := ioutil.ReadFile("bad-words-list.txt") + fullText := string(data) + badWords := strings.Split(fullText, ",") + for user := range arn.StreamUsers() { if user.Introduction == "" { continue } - if flaggedWords.MatchString(user.Introduction) { - color.Cyan(user.Nick) - color.Red(user.Introduction) + 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 + } } } }