about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-01-28T11·07+0300
committerclbot <clbot@tvl.fyi>2022-01-28T12·39+0000
commitd549432b4227c3520fdf790d5df9b4a2e997523e (patch)
treea1b297afbf3d24001f77d447bf155b084379a0fe
parent6a897551ccd04099dc93c052cb91fb768bea664b (diff)
feat(clbot): Add list of strings that should never ping r/3694
... including marcus, which is the name of a person in the channel as
well as the name of a machine of wpcarro's.

Change-Id: I84bd83413175880663b3dafbdb760bbe9d23cef5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5086
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: tazjin <tazjin@tvl.su>
-rw-r--r--fun/clbot/clbot.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/fun/clbot/clbot.go b/fun/clbot/clbot.go
index c259987a52..e5a5990ef2 100644
--- a/fun/clbot/clbot.go
+++ b/fun/clbot/clbot.go
@@ -40,6 +40,8 @@ var (
 
 	notifyRepo     = flag.String("notify_repo", "depot", "Repo name to notify about")
 	notifyBranches = stringSetFlag{}
+
+	neverPing = flag.String("never_ping", "marcus", "Comma-separated terms that should never ping users")
 )
 
 func init() {
@@ -181,7 +183,13 @@ func noping(user string) string {
 // message. With this users will not be pinged for their own CLs, but
 // they will be notified if someone else writes a CL that includes
 // their username.
+//
+// Also applies noping to all instances of the words in `neverPing`.
 func nopingAll(username, message string) string {
+	for _, word := range strings.Split(*neverPing, ",") {
+		message = strings.ReplaceAll(message, word, noping(word))
+	}
+
 	return strings.ReplaceAll(message, username, noping(username))
 }