about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenny Morrison <benmorrison@ttm.sh>2019-03-17 22:51:36 -0400
committerBenny Morrison <benmorrison@ttm.sh>2019-03-17 22:51:36 -0400
commitb892315699b94ba7f0bf9d2a78dbb1a637227ea7 (patch)
tree9ee53c3e05ebe0ec74ab2d8f7e42bbcd1f1f2cb1
parent7ce80ae85d43888b0c8e01e767322f3d1f9e2628 (diff)
downloadgoofbot-b892315699b94ba7f0bf9d2a78dbb1a637227ea7.tar.gz
placeholder for !admin notifications; commented !users
-rw-r--r--main.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.go b/main.go
index 9a11c14..d7973ce 100644
--- a/main.go
+++ b/main.go
@@ -133,6 +133,8 @@ func main() {
 		// respond with currently connected users
 		// TODO: prepend names with _ to avoid pings in irc
 		if strings.HasPrefix(e.Last(), "!users") {
+			// execs: who -q | awk 'NR==1'
+			// then saves the output to bytestream
 			who := exec.Command("who", "-q")
 			awk := exec.Command("awk", "NR==1")
 			r, w := io.Pipe()
@@ -155,6 +157,11 @@ func main() {
 			userdirs, err := ioutil.ReadDir("/home")
 			checkerr(err)
 			c.Cmd.Reply(e, strconv.Itoa(len(userdirs))+" user accounts on ~institute")
+			return
+		}
+		// TODO: send a gotify push notification to the admins
+		if strings.HasPrefix(e.Last(), "!admin") {
+			return
 		}
 	})