From 414c038c68bd88b23f2c42bea0f15b672947ffbc Mon Sep 17 00:00:00 2001 From: Benny Morrison Date: Sun, 17 Mar 2019 23:10:43 -0400 Subject: completed !admin - notifies admins that they are needed via gotify.sh --- main.go | 11 +++++++++-- 1 file 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 } }) -- cgit 1.4.1-2-gfad0