admin: add reboot command

This commit is contained in:
Chris Sexton 2020-04-21 16:51:25 -04:00 committed by Chris Sexton
parent d0998d0a63
commit 21d4b11df9
1 changed files with 6 additions and 0 deletions

View File

@ -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))