From 21d4b11df9a7272caf2940e50341c8a70513343c Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 21 Apr 2020 16:51:25 -0400 Subject: [PATCH] admin: add reboot command --- plugins/admin/admin.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/admin/admin.go b/plugins/admin/admin.go index d8fd18b..7e41916 100644 --- a/plugins/admin/admin.go +++ b/plugins/admin/admin.go @@ -7,6 +7,7 @@ import ( "fmt" "html/template" "net/http" + "os" "strings" "time" @@ -66,6 +67,11 @@ func (p *AdminPlugin) message(conn bot.Connector, k bot.Kind, message msg.Messag return false } + if strings.ToLower(body) == "reboot" { + log.Info().Msgf("Got reboot command") + os.Exit(0) + } + if strings.ToLower(body) == "shut up" { dur := time.Duration(p.cfg.GetInt("quietDuration", 5)) * time.Minute log.Info().Msgf("Going to sleep for %v, %v", dur, time.Now().Add(dur))