about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenny Morrison <benmorrison@ttm.sh>2019-03-17 23:10:43 -0400
committerBenny Morrison <benmorrison@ttm.sh>2019-03-17 23:10:43 -0400
commit414c038c68bd88b23f2c42bea0f15b672947ffbc (patch)
treeeb48ba8762ee1c8d419180d0481e318886bcc2d3
parent8eba807b76007421908346a4d70d055b492af939 (diff)
downloadgoofbot-414c038c68bd88b23f2c42bea0f15b672947ffbc.tar.gz
completed !admin - notifies admins that they are needed via gotify.sh
-rw-r--r--main.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/main.go b/main.go
index d7973ce..5c98787 100644
--- a/main.go
+++ b/main.go
@@ -108,7 +108,7 @@ func main() {
 		}
 		//another basic command/response. required information for the tildeverse
 		if strings.HasPrefix(e.Last(), "!botlist") {
-			c.Cmd.Reply(e, "Creator: ~a h r i m a n~ :: I'm the assistance bot for tilde.institute. Commands: !hello !join !uptime !users !totalusers")
+			c.Cmd.Reply(e, "Creator: ~a h r i m a n~ :: I'm the assistance bot for tilde.institute. Commands: !hello !join !uptime !users !totalusers. If you need the assistance of an admin, issue !admin")
 			return
 		}
 		// when requested by owner, join channel specified
@@ -159,8 +159,15 @@ func main() {
 			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") {
+			//gotify.sh contains a preconstructed curl request that
+			//uses the gotify api to send a notification to admins
+			gotify := exec.Command("./gotify.sh")
+			err := gotify.Run()
+			if err == nil {
+				c.Cmd.Reply(e, "The admins have been notified that you need their assistance!")
+			}
+			checkerr(err)
 			return
 		}
 	})